Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 1.9 KB

websockets.md

File metadata and controls

23 lines (14 loc) · 1.9 KB

feature: WebSockets status: caution tags: polyfill prefixes kind: api polyfillurls: web-socket-js

Making your app real-time is a huge boost and WebSockets give you the ability to add bi-directional communication over a persistent connection to your application to increase interactivity and user engagement.

web-socket-js is a natural polyfill for the JavaScript WebSocket API transferring data through Flash Sockets when WebSockets aren't available.

To use native WebSockets in Firefox, the prefixed MozWebSocket should be used. However, Firefox 11 will support the IETF standard without the prefix.

As a word of caution, the protocol backing the Web Socket API has become an IETF standard, but Safari has not yet implemented the (secure) new version. It is recommended forcing an alternative on Safari or disabling WebSockets on Safari for now.

To make websockets easier to use there are multiple server-side framework solutions. These frameworks generally provide fallback transports (HTTP long polling, HTTP streaming, ajax polling) to support non-websocket browsers. However be prepared to tune the fallback solutions in order to meet the needs of your app.

Sockjs is one a framework which emulates the WebSocket API in browsers and has server implementations for node.js, Ruby, Erlang or tornado.

Socket.io is a Node.js framework that helps with downlevel transports for browsers lacking native WebSocket support (and supports IE6+).

XSockets is a .NET+JavaScript framework that handles fallback via Flash and Silverlight.

For more information see the Full list of possible server-side websocket solutions