WS, WSS, Websocket → Interaction or two-way communication based on HTML5 and HTTP(S)
WebSocket is based on HTTP(S) and was introduced in HTML5
It is a technology that realized real-time interaction (two-way communication) which was difficult between HTTP server and client,
WebSocket connects to the server using port 80 and port 443 for HTTP (ws://) and HTTPS (wss://), respectively.
Socket.IO provides the most general-purpose module or library,
It required implementing event-based, real-time, and bidirectional Websocket communication in the server and client.
♦ Server Socket.IO
|io.on(‘connection’, callback(socket))||The socket is connected and a new client connects.|
Process message/event through callback function for the event from the client socket.
Sending an event
Sending data to a specific client with some event.
Send data to all clients with some event.
|io.of(name-space)||Set up sending and receiving messages in the same namespace|
♦ Client Socket.IO
|io.connect( )||Create a socket.|
Process message/event through callback function for certain event.
Send data to server with some event.
|io(name-space)||Set up sending and receiving messages in the same namespace|
2. WebSocket Application
The feature of WebSocket, which enables two-way communication in real time without disconnecting the connection,
is mainly used in places where real-time data exchange is required,
such as online games or stock trading systems.