what is web sockets
tags: learning networking
content
From HTTP to websockets
- HTTP has following characteristics:
- single request
- short-lived
- client initiated
- stateless
- websocket:
- long lived TCP connection
- back and forth request (fully duplex)
- stateful
- start with HTTP, it’s an upgrade from HTTP
websockets is a long lived connection, the connection might be closed:
- either side closes
- connection dies unexpectedly due to
- network issue, server issue, client app being killed by OS, …
- error can happen anytime during the long lived connection