Junior — Middle
What protocol underlies WebSocket technology for establishing a persistent connection between client and server?
sobes.tech AI
Answer from AI
The WebSocket technology uses the HTTP protocol to establish the initial connection, and then the connection is 'upgraded' to the WebSocket protocol.
The basis for a persistent two-way connection is the WebSocket protocol, which starts with an HTTP request with the header Upgrade: websocket. After a successful handshake, the connection switches from HTTP to WebSocket, allowing real-time data exchange without repeated HTTP requests.
Thus, the protocol underlying WebSocket technology for establishing a persistent connection is HTTP with the Upgrade mechanism, which switches the connection to the WebSocket protocol.