WebSocket fallbacks

Some browsers and networks still cause problems when using WebSockets, hence pusher-js provides fallback mechanisms allowing realtime connectivity in almost any circumstances.

HTTP

Additional JavaScript is required for the HTTP support. This is loaded dynamically (and asynchronously). HTTP streaming and polling are the two forms of HTTP fallbacks supported by the latest version of pusher-js.

Flash (pusher-js < 3.0.0)

Flash has had socket support for many years, and it is possible to emulate native WebSocket API proxying via a Flash object. This support is provided by the excellent web-socket-js library.

pusher-js versions before 3.0.0 include everything required for the Flash fallback to Just Work. The Flash fallback JavaScript and accompanying SWF file will be loaded asynchronously by pusher.js for browsers without native WebSockets.

In previous versions of the pusher.js file (below 1.5), you had to host the SWF file yourself. This is no longer necessary.

Connection strategy

We wrote an extensive series of blog posts about the strategy pusher-js uses to establish a connection, which covers problems with WebSockets, pusher-js strategy implementation and metric collection.

SockJS compatibility

Most browsers have a limit of 6 simultaneous connections to a single domain, but Internet Explorer 6 and 7 have a limit of just 2. This means that you can only use a single Pusher connection in these browsers, because SockJS requires an HTTP connection for incoming data and another one for sending. Opening the second connection will break the first one as the client won’t be able to respond to ping messages and get disconnected eventually.

All other browsers work fine with two or three connections.

Have you tried using the search to find what you’re after? If you still have a question then get in touch with us and let us help you out.