Networking: How to properly leave a session as a client?


what’s the “right” way to leave a previously joined session? I’ve always thought that a simple “open level” node would disconnect the client completely from the actual session but if I use this method I have the problem that I can not join a new session anymore until I restart the complete executable of my game.
If I use the “open level” node in conjunction with “destroy session” (on the client side!) it works… this seems very weird to me.
So what’s the right way to do this?

Thanks and best regards,

Hi, you need to call Destroy Session using some in game menu with a Quit/Leave Game button or similar. We tied the OnClick event of the Leave Game Button to call a custom event called DestroySessCaller in GameInstance wich call “Destroy Session” function, this function is from engine Online Subsystem.

Edit: Notice that the Leave Game should open a “MainMenu” level and after it does you call Destroy Session

You can take a look at Multiplayer Shooter game example that epic provides for free, we based on that.



Thanks for confirmation! I always thought that only the session owner/host needed to call the destroy session event.

Best regards,

1 Like

No problem, on a side note, you can take a look to this for more detail: Multiplayer Shootout | Unreal Engine Documentation

In any case my thoughts are that as you use Leave Game logic for both (Server/Hosting Player and Client Player) then the Open MainMenu map and the Destroy Session works for both cases using same logic. Server player will load mainmenu map while also destroying his session (wich will kick the clients) and for the client open a new map forces to leave the sessioned map and maybe the destroy session just fails but who cares if it allows client to join other or the same session again… is not his session he just join to it…

That is far to be technichal but is the way I think of it… hehe

If it is answered please mark as answered.


1 Like

This node is also used for leaving sessions. Clients also need to call this node when they leave a game.