Skip to main content

The envelope

Every message is one JSON object on a Redis pub/sub channel.
from is a shard id for shards and proxy:<geo>:<name> for proxies. A reply reuses the request’s sender as its addressee and carries replyTo; replies are matched before channel handlers run, so a subscriber never sees somebody else’s acknowledgement.
Delivery is at-most-once, deliberately. Nothing that matters depends on a message arriving: the handoff is committed in MongoDB before the offer is sent, the block journal survives a lost delta, and the entity dedup key makes a redelivery harmless. A message is a hint to go look at durable state, never the state itself.

Message types

HEARTBEAT is declared but never sent. Liveness is a timestamp in MongoDB, not a message.

Redis

The destination geo is read out of the channel name, which is how a publish is routed to the right geo’s Redis. Channels with no geo in the name are broadcast everywhere. Everything is under shard:, so a shared Redis can host other tenants — but not two Atlas networks, because the keys are not namespaced per network.

MongoDB

Writes are majority-acknowledged. Reads default to the nearest member, except the player record at login, which reads from the primary because a stale read would route somebody to the shard they just left.

Intervals