We have just released the first release candidate for the next pusher-js version – 2.2 – including major reliability and latency improvements for clients not able to use WebSockets. Thanks to the refactoring, pusher-js is much more stable and uses significantly less bandwidth on unreliable networks or in older browsers. Give it a shot – \[…\]
We have just released the first release candidate for the next pusher-js version – 2.2 – including major reliability and latency improvements for clients not able to use WebSockets. Thanks to the refactoring, pusher-js is much more stable and uses significantly less bandwidth on unreliable networks or in older browsers. Give it a shot – it will help us discover issues which were not exposed in our testing environment, but first read on to see what changed…
In 2.2 we focused on improving our HTTP-based transports, which had been handled by SockJS before. First, the streaming and polling code – which is used by over 90% of our HTTP clients – was extracted and refactored to be integrated directly with pusher-js. This allowed us to have greater control over connections and improve the test coverage of the library. The new HTTP transports were designed not to need the whole SockJS codebase, so the download size for minified files has been reduced from ~35KB to ~5KB, leading to lower latency, reduced bandwidth and smaller memory footprint.
Even more exciting is the improvement to the connection latency for HTTP transports. We removed the initial HTTP “info” call and included it in the data stream. Another request needed for completing the handshake was removed by extending the protocol again. Version 2.2 needs only 1 round trip, instead of 3, to establish a connection using the HTTP fallback. This gets clients running in old browsers much closer to the latency offered by native WebSockets.
We updated the strategy to take advantage of the refactoring and our knowledge about HTTP transports gathered after releasing pusher-js 2.0. Because some proxies don’t support HTTP streaming and buffer requests until they are finished, polling is also attempted in parallel after a short delay, resulting in a much shorter wait than in a sequential scenario. HTTP transports now also take advantage of transport caching – after connecting for the first time, clients will go straight to the last working transport, saving the time needed to execute the whole strategy.
Version 2.2.0-rc1 also contains smaller improvements – such as adding the ability to specify different hostnames for encrypted connections – and some bugfixes. We have also expanded and improved the test suite, to make the library more reliable.
To summarize, you can expect pusher-js 2.2 to:
Try pusher-js 2.2.0-rc1 now and experience the advantages yourself. Just update the library version in the script tag on your page to 2.2.0-rc1, like below:
In the next days, we’ll focus on evaluating metrics and making further enhancements to the library. By running the new version on your website, you supply us with valuable statistics, which we can use to improve pusher-js even further – the same way we improved 2.0 and 2.1 in the past.