Full-duplex realtime

Normal HTTP

Browser                    Server

   ───── GET /products ──────>
   <──── JSON response ───────
   
then connection done

Web Socket Workflow:

  1. HTTP handshake
  2. Upgrade to WebSocket
  3. Persistent connection
  4. Messages flow both ways
Browser                    Server

   ─────── CONNECT ──────────>
   <────── CONNECTED ─────────

   ← connection stays open →
   
   
WebSocket Server

Connection 1
 ├── socket
 ├── user/client information
 └── connection state

Connection 2
 ├── socket
 ├── user/client information
 └── connection state

Connection 3
 ├── socket
 ├── user/client information
 └── connection state

...
Connection 100