This is similar to Host Migration (P2P) with RTMFP and AS3
I have a webRTC chat room, initially used Twilio and switching to skyway, the situation is that I have a bunch of peers with data broadcast and there is a firebase datastore with the game state.
I want to elect a host and deal with the host dropping. Currently all the peers just running the same code, so I was thinking I could have the one with the lowest uid propose being the host and then get accepted.
How can I make this robust to race conditions?