WebSockets vs Long Polling
This article compares WebSockets and long polling as methods for building live experiences online. Long polling is a more efficient form of HTTP request/response polling, where the server holds a client connection open until new data becomes available or a timeout threshold is reached. WebSockets are built on top of TCP/IP stack and provide an as-close-to-raw-as-possible TCP communication layer with added abstractions for security considerations. Long polling has advantages such as universal support through XMLHttpRequest, but disadvantages include resource intensity and latency issues. WebSockets offer benefits like reduced latency and full-duplex messaging, but lack automatic recovery when connections are terminated. The article also discusses Ably's serverless WebSocket solution for building live experiences and its support for various transports including WebSockets, XHR streaming, XHR polling, and JSONP polling.
Company
Ably
Date published
June 4, 2019
Author(s)
Kieran Kilbride-Singh
Word count
877
Language
English
Hacker News points
None found.