Video in progress
Eight teams in the company want real-time features. How do you provide real-time as a shared platform service?
The platform team takes on connections, auth, routing and delivery, and gives the teams a simple contract: a "send an event to this channel/user" API. For multi-tenancy you need namespaces, quotas and separate metrics.
📖 Answer
If every team builds its own WebSocket server, the result is familiar: 8 kinds of reconnect logic, 8 kinds of auth, 5 parallel connections in the mobile app and battery complaints. One platform solves this, but it must not create a new problem, "the platform is a bottleneck for everyone".
I split the platform like this:
One connection on the client side. The mobile and web SDK open a single multiplexed connection. Teams subscribe to their own channels through the SDK: orders.{userId}, chat.{roomId}. The connection, heart-beat and resume live inside the SDK.
A publish API for the backend. Teams don't have to know WebSocket. They send {namespace, channel, payload} over HTTP or Kafka. The contract is small and stable.
Namespaces and authorization. Each team gets its own namespace. The platform itself doesn't know subscription permissions: it calls back into the team's service, or relies on a signed channel token that the team issues. The second is faster and decouples the platform from the teams' services.
Quotas and isolation. Message rate, payload size and number of channels per namespace. One team's mistake (say, publishing in an infinite loop) must not wreck the others' latency. Separate queues and limits per namespace.
Observability per tenant. Each team sees its own dashboard: sent, delivered, dropped, latency. This saves time in arguments like "your platform lost my message".
The organizational side is harder than the technical one. The SLO has to be written down openly (for example, 99.9% of messages reach an online client within 1 s), including which guarantees are missing: "no exactly-once; be idempotent if you need it". Agree in advance on how a new capability gets added: if someone says "we need presence", does it become a shared feature or is it that team's own job?
To start, I work with 1 or 2 "first customer" teams and migrate the rest later. Gathering the requirements of all eight teams up front and building a big platform often ends in failure.
Sign up to mark studied questions and save your progress.