REST web services: synchronous or asynchrous?

Ajit picture Ajit · Apr 17, 2013 · Viewed 52.3k times · Source

What is the default behavior of REST web services - synchronous or asynchronous?
If it's synchronous then can we create asynchronous?

Answer

UltraInstinct picture UltraInstinct · Apr 17, 2013

"Synchronous" or "Asynchronous" is the behaviour of the client that is requesting the resource. It has nothing to do with REST webservice, its structure, or the supporting server.

Synchronous behaviour:

  • Client constructs an HTTP structure, sends over the socket connection.
  • Waits for the response HTTP.

Asychronous behaviour:

  • Client constructs HTTP structure, sends the request, and moves on.
  • There's another thread that is waiting on the socket for the response. Once response arrives, the original sender is notified (usually, using a callback like structure).