News for hackers. Stuff that matters.
Re:You might not need a WebSocket by damon_c on Thursday July 10, 2014 @12:28PM (#8015532)
Conceptually, polling just seems dirty.

if (some event occurred){ do something over and over every so often that requires multitudes of processes including authentication, DNS etc. across many machines, that might not even ever return any value to the user. }

is not as nice as,

on('the arrival of a message', doSomething)

edit: pardon the sloppy pseudo syntax...

Re:You might not need a WebSocket by matt_kantor on Thursday July 10, 2014 @01:28PM (#8015921)
Why not server-sent events[0]?

    var source = new EventSource('/some/url/path');
    source.onmessage = doSomething;
[0] http://dev.w3.org/html5/eventsource/
Re:You might not need a WebSocket by YZF on Thursday July 10, 2014 @01:02PM (#8015761)
agreed but "long polling" is not really polling because you're blocking on the HTTP request. Something over UDP sounds like the answer to the complaints about TCP connections getting dropped though. TCP was built for streaming...
Re:You might not need a WebSocket by colanderman on Thursday July 10, 2014 @03:45PM (#8016779)
TCP technically relies only on state on the endpoints, so it "should" never be dropped unless the endpoints agree. But NAT and various other interlopers ruin this model, as state is then kept in middle-boxes.

UDP would evince the same problem when traversing NAT, since it also would require state to be kept in middle-boxes. The only difference is that instead of periodically reconnecting, you'd need to periodically ping.