Master Client Timeout Detection

I read in the Host Migration page that it is recommended to implement a Master Client Timeout Detection mechanism by saving timestamp of last event received from Master Client.
While I think its the perfect solution, I am totally lost on how to achieve this.
Do we need to change server side code or something?
Please give us some hint.

Thank you very much!

Comments

  • Hi @Warbears,

    Thank you for choosing Photon!

    There are a lot of heuristics and approaches to this.
    Of course server code is ideal but not necessary, as you've read we already have built-in master client switching but the edge case is client timeout (default is 10 seconds).

    You can make this detection mechanism client based:

    A. send a heartbeat from master client to everyone. if next candidate does not receive the hearbeat after a while he becomes the new master client.
    B. everyone or just next candidate keeps checking if master client is alive by sending an event and waiting for an ack. if no ack is received after a while the next candidate becomes the new master client.

    You could also handle some situations like app moved to background or lost focus by switching the master client from the master client itself or sending an event from the master client informing others that his app went to the background or lost focus or has device has low batter or poor ping etc. and others are aware...
Sign In or Register to comment.