How do I Migrate Hosts if Host Disconnects?

  • Hello! I'm trying to update my game PIXLR so that if the host quits, the canvas is saved by the peers and they all reload the layout and try to connect again, creating a new host.

    When I close the host's tab, the chat on the peer's end say signalling: left room. However, when I try using the code below, I get an error from the peers still connected

    Multiplayer | On signalling left room Multiplayer | Disconnect from signalling server

    Multiplayer | X Is Host Function | Call Save(0)

    So the user disconnects, then in the save function I save the canvas to a global array, as well as toggle a global variable "migrate" to 1. Then I reload the layout. The first user to reconnect should be host, and I have an event where if the host has migrate set to 1 to call the load function and rebuild the level from the array data. However, once the layout reloads I get this error:

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)