Websocket API

Understand core concepts of WebSocket.

Bidirectional communication

HTTP-based communication requires a client to trigger the flow. Only the client can initiate an HTTP request to send or receive data from the server. The server can’t trace the client to send a message back to the client. It has to wait for the next HTTP request from the client. That’s because the server doesn’t have a reverse connection to the client.

This works well in many scenarios, which is why the REST API is so popular. However, there are times when such a design fails to deliver what we need. Consider, for example, a chat application. If we implement a chat application based on REST APIs, the server will have to hold ...