How do I disconnect from a P2P server?

I can’t find an event to disconnect from the P2P server and I noticed that it remains connected when I go back to the menu of my game. How do I fix this?

Is this a problem that needs to be fixed? :thinking:

Idk perhaps to save the Internet after the player has stopped playing online and is back in the menu

Unless you send data from a peer to another, there is no traffic on the connection. Just being connected to the broker therefore won’t use any internet.

but traffic is still send, even if the other user has no listener events for it?

in the Lobby, all my users are connected to each other. however, when the duel starts i want the connection to be as best as it can, and i guess that would include not receiving messages from the lobby anymore.

i guess, i could send each individual (instead of all) the message, depending on their status (duel active or not).

Yep all sent messages are received. You can try to use MQTT if you really want to only get sent the messages you need (thanks to it’s pub sub pattern). You can also try to disconnect from all other peers while the duel is going on and reconnect to them when you get back into the lobby (disconnection actions coming in next version).

1 Like