What is Socket.IO ? | Sailesh Verma

Post

editor-img
Sailesh Verma
Feb 28, 2023

What is Socket.IO ?

Socket.IO is a cross-browser JavaScript library that provides event-driven communication capabilities for use in real-time applications. It has two parts: a client-side library that runs in the browser, and a server-side library for Node.js.

media

Socket.IO was created in 2010. It was developed to use open connections to facilitate real-time communication, still a relatively new phenomenon at the time.

Socket.io with an example:

Lets assume that we are working on a chat application. When user A is typing something, user B should know that user A is typing. If we use HTTP calls at that point of time, user B will never be able to see actual status of other person because of the delay.

media

So in this case, we use web socket to pass the data that user A is typing on his device that will send only one data packet which will just notify the server that he is typing and will be delivered to user B.

In general, Socket.io is a very useful piece of technology and is incredibly relevant today for highly interactive applications. With web socket, there is no negotiation protocols and connection remain open as long as users concerned are registering for service with the web server. The payload is significantly less than http/https protocol.