[erlang-questions] Two beautiful programs - or web programming made easy

Alain O'Dea <>
Sun Feb 13 14:42:30 CET 2011


On 2011-02-13, at 6:48, Florian Weimer <> wrote:

> * Joe Armstrong:
> 
>> How the heck can you easily send an an asynchronous message from a client to
>> a server?
>> 
>> HTTP get and post wait for a reply and thus are synchronous.
>> 
>> By asynchronous I mean "fire and forget" like UDP.
>> 
>> If it easy easy them I'd love to know how ..
> 
> XMLHttpRequest has an asynchronous option.
> 
> And you can get emulate a single full-duplex connection using two
> half-duplex ones, so Websockets is just an optimization, and likely
> not even a very much needed one.  The barrier right now seems to be
> the BSD sockets API and kernel state management, and you still have
> that with Websockets.

HTTP is a synchronous protocol.  The async option is XmlHttpRequest is only to background the synchronous request processing so that the browser remains responsive.

Websockets is not merely an optimization.  It removes the packaging around conversational events in a web application.  This has far-reaching scalability impact since it reduces the cost per client substantially in a chatty application.

For an application using SEBG tge reduced cost per request will reduce the delay between a server event and its realization on the client.

Again, XmlHttpRequest's async option does not make the HTTP request itself asynchronous (it wouldn't be HTTP).  It merely runs the synchronous requedt in the background on the client.


More information about the erlang-questions mailing list