Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 26 lines (15 sloc) 2.054 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 versions of Firefox before 11, the prefixed MozWebSocket should be used.

The protocol backing the Web Socket API has become an IETF standard, but Safari did not implement that version until Safari 6. To support Safari 5, the WebSocket server needs to support both -76 and the RFC6455 versions, or you can use Flash or Java sockets (if available).

The -76 version has a possible security problem for users behind buggy transparent proxies. The same security problem exists with Flash sockets and Java sockets. None of these options are recommended.

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

Something went wrong with that request. Please try again.