Search code examples
websocketcross-platformlong-pollingserver-sent-events

Web Socket vs Long Polling vs server-sent events for a cross-platform chat application?


What is preferable for a cross platform chat application web service, a Web Socket or a long polling or a server-sent event ?

Thanks in advance !!!


Solution

  • WebSocket is built for applications such as this, while long polling (however well done) is a hack. Support for WebSocket is also very broad, and you can use e.g. a flash fallback in older browsers. Server-sent-events are only part of a solution, and you have a big support gap in IE. (Shameless promotion of an open source project I'm connected to: take a look at WAMP (http://wamp-proto.org) and Crossbar.io (http://crossbar.io), which offer communication patterns on top of WebSocket and provide a lot of infrastructure for building a chat application.)