[erlang-questions] Mochiwebsockets was Re: Long polling

Gleb Peregud gleber.p@REDACTED
Fri Jul 20 10:36:31 CEST 2012


On Fri, Jul 20, 2012 at 10:24 AM, Gordon Guthrie <gordon@REDACTED> wrote:
> There are a couple of complications - we already use one long-poll for
> server-to-client updates - in that case the client posts changes and
> the server works on them and then streams out updates on a separate
> long-poll. Lets put that aside and focus on this use case.

It can be important. Some browsers limit number of concurrent
connections opened to a single host to two. This means that if you
would have two long-polling connections opened at the same time, you
won't be able to do a simple AJAX request on those browser (it will
queue after long-polling connections and possibly timeout). Afair
older IE had this problem, I don't recall in more details which one
was it.

> Single domain
> It is a single registration event - ...
> It's the server saying "are you still there?"
> Needs to be reliable. ...
> Yeah, lots of JQuery - ...
> I will tolerate any size of code base if it is encapsulated nicely. ...

So it seems that you don't need any complex solution. Most probably a
simple long-polling XmlHttpRequest with a 30 seconds connection
cycling (to work through proxies) should work well for you. If you
don't care about proxies ~50 seconds will be better choice to preserve
bandwidth and CPU on server.

Essentially you could take parts of Bullet which does cycle
connections, while jQuery handles most intricacies related to error
handling.

> What would the benefits of Cowboy over Mochiweb be?

Since it seems that you don't need websockets after all, if Mochiweb
works well there is no real need to switch.

Cheers,
Gleb



More information about the erlang-questions mailing list