Esc to close Ctrl + K to open anytime
Uncategorized

What is WebSocket

WebSocket is bidirectional, a full-duplex protocol that is used in the same scenario of client-server communication, unlike HTTP, it starts […]

What is WebSocket

WebSocket is bidirectional, a full-duplex protocol that is used in the same scenario of client-server communication, unlike HTTP, it starts from ws:// or wss:// It is a stateful protocol, which means the connection between client and server will keep alive until it is terminated from both ends.

Let’s take an example of client-server communication, there is the client which is a web browser and a server, whenever we initiate the connection between client and server, the client-server made the handshaking and decide to create a new connection and this connection will keep alive until terminated by any of them. When the connection is established and alive the communication takes place using the same connection channel until it is terminated.

This is how after client-server handshaking, the client-server decides on a new connection to keep it alive, this new connection will be known as WebSocket. Once the communication link is established and the connections are opened, message exchange will take place in bidirectional mode until the connection persists between client and server. If anyone of them (client-server) dies or decides to close the connection is closed by both of the party. The way in which sockets work is slightly different from how HTTP works.

Use of WebSocket

Real-time web application

Real-time web application uses a web socket to show the data at the client end, which is continuously being sent by the backend server. In WebSocket, data is continuously pushed/transmitted into the same connection which is already open that is why WebSocket is faster and improves the application performance.

Continue Reading

You've reached the end of the free preview. Subscribe free to unlock the rest of this article.

Discussion (0)

admin

admin

Contributor