Notification Deduplication for a Go Gaming Voice Lobby Fan-Out Path
Short answer: implement notification deduplication as a server-owned, stable event-ID contract, persist the acceptance decision before fan-out, and make every gaming voice lobby client reconcile those IDs after reconnecting instead of assuming that a live connection implies exactly-once delivery. This is an application invariant, not a transport feature. A realtime API can remove polling and…
Notification deduplication is key for a gaming voice lobby's fan-out path. Implement it by assigning a stable event-ID to every business event before it reaches the realtime publisher. This ID remains the same across retries, unlike delivery attempts. For voice lobbies, use a (lobby_id, recipient_id, event_id) key to avoid suppressing the same event for different players.
Persist the acceptance decision before fan-out. Record the event and ID durably, then schedule fan-out. If these actions can't share a transaction, use an outbox record committed with the lobby state change, and let a dispatcher publish it repeatedly until acknowledged.
On the client side, maintain a bounded set of applied event IDs. Ignore duplicates and send the last stable checkpoint on reconnect. The server reconciles the subscription state against durable events, not socket state. Retain the deduplication ledger long enough to cover the maximum offline-and-reconnect interval.
The design has four invariants: authorization is separate from subscription state, the event store gives each committed business transition a unique ID, fan-out may retry with each recipient applying events idempotently, and separate audit records distinguish different issues. Failure boundaries lie between durable acceptance and transient delivery.
A 429 response is a capacity signal, not proof of rejection or acceptance. Even a successful publish response only proves the operation met the provider's contract, not that every device committed the corresponding UI state.
Retain enough data to answer three questions without looking at mutable payload text: which principal authorized the action, which stable event ID represented it, and which recipients applied the checkpoint. For auditability, keep data to answer these questions without examining the payload. Dedupe storage is useful, but retention should follow policy, not grow indefinitely. Inject various scenarios during release testing to ensure the system behaves as expected.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.