Engineering Blog

Engineering: Server-Sent Events vs WebSockets

Why the AI Industry strictly normalized on SSE over bidirectional WebSocket channels.

Unidirectional vs Bidirectional

A user asks a question, the server streams the answer. The data flows fundamentally in one direction until exhaustion. A full multiplex WebSockets implementation presents immense state management overhead for purely unidirectional streams.

  • SSE leverages standard HTTP protocols automatically supporting corporate proxy routing.
  • It elegantly resolves the 'Chunked Transfer Encoding' format required for rolling Markdown.
  • Eliminates the handshake latency and Ping/Pong heartbeat requirements of generic WS engines.