Thursday, September 28, 2023
ExplainerIoT Software&ToolsTech/Web

Introduction of Socket.IO – A real-time web applications

What is Socket.IO?

Socket.IO is a JavaScript library for real-time web applications, built atopEngine.IO.. It enables real-time, bi-directional communication between web clients and servers. It has two parts: a client-side library that runs in the browser, and a server-side library for node.js. Both components have an identical API. Socket.IO primarily uses the WebSocket protocol with polling as a fallback option, while providing the same interface. Although it can be used as simply a wrapper for WebSocket, it provides many more features, including broadcasting to multiple sockets, storing data associated with each client, and asynchronous I/O.

You can use SocketIO easily with Express. Read this article ExpressJS – Web framework for Node.js

Why use

If you want to make a chat application with popular web applications stacks like LAMP (PHP) has traditionally been very hard. It involves polling the server for changes, keeping track of timestamps, and it’s a lot slower than it should be. Sockets have traditionally been the solution around which most real-time chat systems are architected, providing a bi-directional communication channel between a client and a server.

This means that the server can push messages to clients. Whenever you write a chat message, the idea is that the server will get it and push it to all other connected clients.


Some real-time applications are −

  • Instant messengers − Chat apps like Whatsapp, Facebook Messenger, etc. You need not refresh your app/website to receive new messages.
  • Push Notifications − When someone tags you in a picture on Facebook, you receive a notification instantly.
  • Collaboration Applications − Apps like google docs, which allow multiple people to update same documents simultaneously and apply changes to all people’s instances.
  • Online Gaming − Games like Counter Strike, Call of Duty, etc., are also some examples of real-time applications.

Socket.IO is NOT a WebSocket implementation. Although Socket.IO indeed uses WebSocket as a transport when possible, it adds some metadata to each packet: the packet type, the namespace and the ack id when a message acknowledgement is needed. That is why a WebSocket client will not be able to successfully connect to a Socket.IO server, and a Socket.IO client will not be able to connect to a WebSocket server either. Please see the protocol specification here.

You may like also:

How To install Socket IO


npm install --save

Javascript Client

npm install --save

How To Use

Visit these links

Socket.IO has played an important role in the popular adoption of Node.js by making WebSockets both accessible and reliable. Version 1.0 represents a major step in its evolution and the extraction of Engine.IO has opened up some interesting possibilities for the Node.js ecosystem.

We’ve only covered only introduction of Socket.IO in this article, you can read about the rest at the Socket.IO website:

You may like also:


Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. I am a tech blogger and an IoT Enthusiast. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning!

2 thoughts on “Introduction of Socket.IO – A real-time web applications

Leave a Reply