Understanding WebSocketsÂ
In the early years of the web, the classic request-response model of HTTP communication put a bottleneck limitation on any application that required the server to send updates directly to the client. To overcome this limitation, the WebSockets protocol was invented.
WebSockets is a TCP protocol that was invented to allow web browsers to open interactive communication sessions with web servers. Unlike HTTP, WebSockets is not based on the request-response communication model. Instead, it opens a full-duplex communication channel with the server, allowing both server and client to exchange messages in real time. This makes it easier to build more creative web apps such as chat, online gaming, real-time statistics, and much more.
Although WebSockets is totally different from HTTP, it's designed specifically to work over the HTTP protocol. Clients perform web-socket connections by handshaking a web server using the HTTP upgrade header, which is the topic of the following...