Socket.IO is a library that enables bidirectional and event-based communication between clients and servers.

Installation:
Open Cmd and run the command given below:
npm install socket.io-client
Import:
import * as io from 'socket.io-client';
Connection:
- From same domain

- From different domain
![]()
In case of different domains, please make sure to enable Cross-Origin Resource Sharing (CORS) on the server.

Events:
1. Adding Event Listener to socket
socket.on("connect", () => {
console.log(socket.id); // x8WIv7-mJelg7on_ALbx
});
- Removing Socket Listeners :
socket.off("connect", () => {
console.log(socket.id); // x8WIv7-mJelg7on_ALbx
});
End to End Technology Solutions