So far, we’ve talked about how to send requests to an HTTP endpoint and get a response. However, under this architecture, only the client (i.e., the browser) can initiate communication. What if the server wants to notify the client about updates? What do the client and server need to be able to send messages to each other in real-time? In this chapter, we introduce another protocol called WebSocket, which provides full-duplex communication over TCP.
Introduction to WebSocket
In the traditional HTTP model, a client (e.g., a web browser) has to initiate a request, and the server ...