is a Javascript library that enables bi-directional realtime communication between web clients and servers. It has two main parts: a client-side library that runs in the browser, and a server-side library for Node.js. These components are identical to an API. In layman’s terms, allows clients and servers to push messages to each other in real time.

An example of + Node.js

Since it’s bi-directional, it uses a WebSocket protocol with long-polling as it’s fallback option. The focus on real-time analytics, binary streaming, instant messaging, and document collaboration. Some of their notable clients are Microsoft OfficeYammer, and Zendesk.

In May 2017, they released 2.0. These changes included uws as the default WebSocket engine and developers can create custom parsers.

Use Case

Citing Vaibhav Gautam, “Libraries like socket.IO are needed when we need real time in our app. Let me explain this in little more detail. lets assume that you are developing a game, which is multiplayer and 2 or more users can play that simultaneously. Then in that case you won’t be making HTTP or HTTPS calls because of many reasons and one of them is that their packet size is large and other is that these calls are very slow. In such scenarios we use libraries like sockets to send and receive data to and from server. sockets are really fast and are capable of sending only those data packets which are needed. using HTTP programming you can never create any multiplayer game or any app which will be interacting with server on realtime basis.”



Getting Started