TIL: Websockets and SSE

Protocol basics at the transport layer.

Today at work I learned of the existence of Server Sent Events (SSE) and some transport layer/protocol facts about Websockets.

SSE is just a standardization of the old Comet model. The browser initiates an HTTP request, the server and the client keep the underlying TCP connection alive, with the server sending events-as-they-happen by adding more data onto a neverending HTTP response body.

Websockets also start life as an HTTP request to the server, but the initial request is to switch protocols, after which the server and client drop down to communicating in a binary frame-based protocol on top of the underlying TCP connection.