PREVIEW This is a preview release. sparQ is in active development and some features on this page are still being built. It's open source, AGPL v3, built in the open.

Why server-sent events, not WebSockets

Architecture

We picked SSE for our real-time layer because it's boring. After a year in production, it's been the right call.

SSE is one-way HTTP. The client opens a long-lived GET request. The server pushes events as they happen. The client reconnects automatically on disconnect.

Things that are easier with SSE than WebSockets: load balancing (it's just HTTP), authentication (use the same cookie as the rest of the site), debugging (it's in the network panel), proxy traversal (it survives corporate firewalls that WebSockets often don't).

Things we gave up: bidirectional messaging. We post writes via regular fetch calls and receive updates via SSE. That separation has actually clarified the code, not complicated it.