News for hackers. Stuff that matters.
Re:A WebSocket Primer by pornel on Monday December 16, 2013 @03:57PM (#6917761)
It's funny that the article says "This enables server sent events" without actually referring to the HTML5 Server Sent Events API:

http://www.html5rocks.com/en/tutorials/eventsource/basics/

SSE is realtime server->client protocol that's fully compatible with HTTP and has lower handshake overhead (no Upgrade roundtrip, doesn't require HTTPS to go through proxies).

Re:A WebSocket Primer by rch on Monday December 16, 2013 @04:29PM (#6917937)
Agreed. Both approaches have their place, but I see SSE getting overlooked too often.
Re:A WebSocket Primer by yogo on Monday December 16, 2013 @06:11PM (#6918503)
I'm not 100% up to speed on SSE but since there is no way to "push" to a client isn't it just some form of polling at the end of the day?

It's also not supported by IE yet: http://caniuse.com/eventsource

Compare with http://caniuse.com/websockets

Re:A WebSocket Primer by dspillett on Tuesday December 17, 2013 @05:25AM (#6920388)
> isn't it just some form of polling at the end of the day?

Probably long-poll, a single connection from client to server kept alive with the occasional byte sent one way which sends the message and disconnects when there is something to send (the disconnect, requiring a new request from the client is because some clients won't process what has been sent immediately unless the connection is closed).

I once wrote a messaging client that operated this way. It is efficient in terms of bandwidth use and client footprint, though if you are using a process based we server it can be quite inefficient there (an event driven service on few processes/threads is far more efficient for handling many long-lived low-activity connections).

Re:A WebSocket Primer by rch on Monday December 16, 2013 @06:39PM (#6918670)
That's in keeping with how I think of it: open connection from the client with some reasonable expectations set around e.g. reconnection behavior.

Looks like Chrome and Firefox have had support for quite some time. I'm alright with that.

Re:A WebSocket Primer by sampk on Tuesday December 17, 2013 @01:30AM (#6919867)
IE is just trying to look all hip and cool and EventSource hasn't generated much hype so it doesn't get implemented.. shame.
Re:A WebSocket Primer by lostcolony on Monday December 16, 2013 @10:49PM (#6919508)
Do SSEs now support CORS? I know when writing a webapp at the start of this year we went with Websockets because we needed to work in a cross domain environment and SSEs didn't support it; I know it was to be added to the standard, and Firefox had unofficial support of it, but I can't find anything anywhere indicating if Chrome and Safari are supporting it (and IE will probably get it in 12 eyeroll).
Re:A WebSocket Primer by jessaustin on Monday December 16, 2013 @04:43PM (#6918034)
Thanks for the pointer! This seems much more straightforward than websockets.