Building a Chat application using Server sent Event and node.js

I am new to node.js and SSE. I want to create a chat application using SSE and node.js. can any one guide which is better SSE or websocket? Is there any polyfill for IE using js not php for IE7+

Please suggest.

Thanks in advance.

If the client will never make requests to the server and the server will be doing all the pushing, then you should use server-sent events.

However, for a chat application, because clients need to constantly send requests to the server, the WebSocket API is the natural choice.

The "polyfills" for the WebSocket API are other technologies that mimic a socket connection in a much less efficient manner, like, for example, Ajax long polling.

WebSocket libraries like Socket.IO are designed to use the WebSocket API when available and fall back to other technologies like Ajax long polling when the WebSocket API is not available.

Which server-side language you use is pretty much irrelevant.

First of all think about compatibility.

SSE: http://caniuse.com/#feat=eventsource

IE: no support

Firefox: Version 6+

Opera: Version 11+

Chrome: Unknown version +

Safari: Version 5.1+

WebSocket: (protocol 13) http://caniuse.com/#feat=websockets

IE: Version 10+

Firefox: Version 11+

Opera: Version 12.1+

Chrome: Version 16+

Safari: Version 6+

I know a lot of modules that works with WebSockets (including one made by me simpleS, I made a simple demo chat to show how should the connections be organized in channels, give it a try), and a bit lesser those which works with SSE, I guess that the last ones are less tested and you cannot rely to much on them in comparison with modules that works with WebSockets.

You can find mode information about the WebSockets and SSE here: WebSockets vs. Server-Sent events/EventSource