Get the latest tech news

The hidden complexity of scaling WebSockets


WebSockets are at the very core of Compose. Learn how we scaled them to support 1000s of concurrent users.

Since WebSocket connections are persistent, this can lead to situations in which old servers are active for minutes or even hours after a deploy until the managed service forcibly terminates the process. By monitoring heartbeats on both ends, we detect and handle rare cases where the client side network appears functional but the server never receives responses. To mitigate such issues, Compose uses server-sent events (SSE) as a fallback for receiving updates, while HTTP requests handle client-to-server communication.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of websockets

websockets

Photo of hidden complexity

hidden complexity

Related news:

News photo

Back to basics: Why we chose long-polling over websockets

News photo

An Analysis of the Performance of WebSockets in Various Programming Languages (2021)

News photo

WebSockets cost us $1M on our AWS bill