[erlang-questions] Long polling
Tue Jul 17 17:01:06 CEST 2012
On Tue, Jul 17, 2012 at 4:57 PM, Gordon Guthrie <> wrote:
> I am building a softphone which needs to register with the server to say "I
> am available" for incoming calls.
> So it makes an HTTP POST request to the server and that notifies the
> softphone gen_srv that is is available.
> At that point I leave the TCP request hanging on a receive waiting for a
> notification that the socket has been torn down (and which point it
> unregisters the phone).
> My question is: how long can I leave the request up? Infinity? or do I need
> to have a timeout/reregister cycle setup?
You have to cycle it. Some proxies timeout connections after 30
seconds, some after 45 some after 60. It is very tricky to get it
right for all browsers and all platforms. Generally if you want a
robust solution use something like SockJS or Socket.IO or Bullet.
More information about the erlang-questions