Does PubNub use WebSockets or some other protocol?
Modified on: Mon, Aug 10, 2020 at 2:19 AM
WebSockets is a promising protocol, but faces a number of hurdles in today's networking environments:
- Build WebSockets Apps, Not WebSockets Infrastructure
- Many networks (e.g. schools, corporations, government) use proxy servers which block the WebSockets protocol.
- Secure WebSockets (using SSL) is often blocked by the same networks (a tunnel cannot be established).
What are the benefits of WebSockets?
WebSockets, part of the HTML5 specification, enables two-way communication between web pages and a remote host. The protocol is designed to achieve the following benefits:
- Reduce unnecessary network traffic and latency using full-duplex through a single connection (instead of two)
- Streaming through proxies and firewalls, supporting simultaneously upstream and downstream communication
- Backward compatible with the pre-WebSocket world by switching from an HTTP connection to WebSockets
- Make sure to check out the current state of WebSockets.
PubNub is Protocol Agnostic or Independent. But what does that mean?
The PubNub Data Stream Network believes in a protocol independent open mobile web; meaning that we will use the best protocol to get connectivity through any environment. Protocols, like WebSockets, can get tripped up by cell tower switching, double NAT environments, and even some anti-virus software or proxy boarder authorities. PubNub provides client libraries specifically so we can auto-switch the protocol and remove socket level complexities making it easy for developers to build apps that can communicate in realtime.
PubNub has used a variety of protocols over time, like WebSockets, MQTT, COMET, BOSH, SPDY, long polling and others, and we are exploring architectures using HTTP 2.0, and others. The bottom line is that PubNub will work in every network environment, and has very low network bandwidth overhead, as well as low battery drain on mobile devices.
Did you find it helpful?
Can you please tell us how we can improve this article?