[erlang-questions] Mochiwebsockets was Re: Long polling

Gordon Guthrie <>
Fri Jul 20 10:24:36 CEST 2012


Gleb

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.


For the softphone:

> 1) Do you plan to use it cross-domain or just on one domain?

Single domain

> 2) Do you want to have as low latency as possible on every browser? Or not?

It is a single registration event - is this softphone available for me
to get Twilio to push a phone call to it - the actual phone call is
handled peer-to-peer in the browser - so latency is not so important -
I have a call phone call setup time anyway

> 3) Are you interested in just one-directional server-to-client push?
> Or in both directions?

It's the server saying "are you still there?"

> 4) Do you need fast and robust connection error detection?

Needs to be reliable.

> 5) Do you use jQuery already? How large JS library will you tolerate?

Yeah, lots of JQuery - given that the phone itself doesn't ship with
much javascript it should be OK...

> 6) How large server-side library will you tolerate?

I will tolerate any size of code base if it is encapsulated nicely.
Its just when the suggestion is that I rip out mochiweb, fire in this
and that, I start thinking, erk!

> IMO in a long run it is probably a good idea to switch to Cowboy (and
> Mochicow) would help you a lot with the switch.

What would the benefits of Cowboy over Mochiweb be?

Gordon

On 20 July 2012 07:39, Gleb Peregud <> wrote:
> On Fri, Jul 20, 2012 at 12:46 AM, Loïc Hoguin <> wrote:
>> You don't need a "socket server", whatever that is, you can just use
>> websockets directly in Cowboy, or if you need a long polling fallback
>> there's Bullet available, which is just a library of one module + one js
>> file really. Either way they don't try to anticipate your needs, they just
>> transport data.
>
> There are few basic questions which are very important here to decide
> which approach to use:
>
> 1) Do you plan to use it cross-domain or just on one domain?
> 2) Do you want to have as low latency as possible on every browser? Or not?
> 3) Are you interested in just one-directional server-to-client push?
> Or in both directions?
> 4) Do you need fast and robust connection error detection?
> 5) Do you use jQuery already? How large JS library will you tolerate?
> 6) How large server-side library will you tolerate?
>
> If you don't care about latency that much and you are dealing with
> just one domain - probably Cowboy + Bullet would be easiest to use.
>
> If you care about latency in all browser and you have to work
> cross-domain - probably SockJS would be the best solution. If you want
> to port server-side part of SockJS logic into your app, it should be
> pretty straightforward and I can help you with it.
>
> IMO in a long run it is probably a good idea to switch to Cowboy (and
> Mochicow) would help you a lot with the switch.



More information about the erlang-questions mailing list