if the only state is the connection itself at the transport level
This is not entirely true. Web socket connections exchange keep-alives as a payload of level 7. Others may argue that it is more accurately described as a sublevel somewhere between layers 6 and 7 ... but in any case it is well above the transport layer.
And many applications use web sockets in other ways that are also not stateless. After connecting, then authenticated, there is no need to constantly re-authenticate, because the client in the juice will now be the same client after 15 minutes, and this is an overhead that could not be avoided in a serverless environment - every action on the website should be re-authenticated. In another example with a constant stream of data, the server can track what was sent, or which specific subset of the stream the client is interested in.
If you do not support (or do not need) a permanent connection to the server, you can ask the question: "Why are you using a web socket?"
Perhaps this is also true: HAProxy, a widely used web socket load balancer, maintains a constant connection to one server server for every current connection to the web socket. If the backend server goes offline, the balancer does not need to select another server for an existing connection. The client will need to reconnect.
Michael - sqlbot
source share