Web sockets run on top of the web socket protocol, which is a TCP protocol that provides a framework for two-way communication between the client and the server.
This is different from the standard request reply model, in which only the client can initiate a request to the server and only then, receive a response.
Web sockets work by first establishing a socket connection. This is actually done by initiating an HTTP request, so technically, it is still the client that initiates the request for a socket connection, and only after that request is fulfilled and a connection is established can the server send over information independently to the client:
The request to initiate a web socket connection comes with special headers (Connection and Upgrade) that indicate that the client wishes to switch to the web socket protocol.
The server (if it supports web sockets) then...