Server disconnects when a match starts

Hello,

I am currently working on an online multiplayer game using NakamaBlueprintsDemo (UE5.2.1).
I modified the widget blueprint “WBP_Matched”, and instead of showing the list of matches found, I modified to open a level for the actual match.
The problem is, the matchmaker works with no issue, and the game opens the level as soon as it finds the match, but I do not see 2 characters spawned in the game.
When I check the server log on docker, it shows “Cleaned up closed connection status registry”, “Could not send close message” and “Closed client connection”. It seems to be that the game disconnects from the server once a new level opens.

As for the replication and movement updates I am using General Movement Component.

Hey. Firstly, in the Blueprint Demo the Nakama Client is attached to the Player Controller which does not persist between maps, so the disconnection you see is intended, as the Player Controller is destroyed when you open a new level, causing the realtime client (socket) to disconnect. But you could potentially set it as the same player controller on the newly loaded map and setup a new client connection to Nakama.

To get the connection to persist between maps you need to move the Nakama Clients to the Game Instance in Blueprints, or optionally to a C++ Subsystem. The demo was setup to only showcase the features in a single map setting.

It also seems like you forgot to attach Open Level to the “Success” Node (not sure if intended) before Opening the new Level. I also think You should do the spawning logic once you enter the new map, maybe on the BeginPlay Level Blueprint?

Let me know if you need any further assistance on this topic :slight_smile:

Hello thank you for the input.

By “move the Nakama Clients to the Game Instance in Blueprints”, do you mean to move all of the nodes that is on “Nakama Demo Controller” (Blueprint class) to a Game instance?
If so, would that affect the authentication process that is in the first main screen widget?

So I tried to bring the content in NakamaDemoController to a Game instance that I created, and it shows numerous errors as the logic is not compatible with the game instance.