Menu

FastAPI Live Poll Host Reassignment: Deterministic Leases for Split-Brain Clients
📰

FastAPI Live Poll Host Reassignment: Deterministic Leases for Split-Brain Clients

DEV Community: fastapi·tony chen·3 days ago
#6eSohvSy
#devtofastapi#devto#dev#epoch#host
Reading 0:00
15s threshold

TL;DR: when two clients both think they are host, do not let either client settle the dispute. Give the server one authoritative host lease, attach a monotonically increasing epoch to every assignment, and require host commands to carry both that epoch and a narrowly scoped capability token. Reconnects may restore a session, but they must never restore authority from local state. This makes reassignment deterministic even when WebRTC messages arrive late, twice, or out of order.

Consider a property-management training session with a multiplayer-style lobby and a live poll. The browser that created the room starts as host. If it disappears, participants still need the poll to continue, yet promoting the wrong browser lets two people open voting, close it, or publish results. The important design axis is not transport speed.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.