Ue5 function issue


Instead of this, what will i use.?

You’re using an old API they got rid of, the callback is already set for you. This should help, I tested that it works:

Grab the Nakama Unreal template for blueprints it helps a lot and is up to date.

ok thank you so much @shadowfinderstudios
And this bind will automatically trigger some one joins and leaves?

I’m actually struggling with getting it to reconnect after it loses connection right now myself. I’ll let you know if I manage to get everything working.

The issue with the template seems to be threefold;

  1. A few of the blueprints don’t compile because they are using deprecated calls that have to be replaced.
  2. If you get it to run successfully, after about 60 seconds (regardless what you’ve got your token expiry set to on the server) the token will be invalid. I’ve come up with a blueprint that fixes that by every 50 seconds in a timer checking the expiry and then refreshing and if it can’t refresh then it re-authenticates. (Why something like this wasn’t already in the template is worrisome.)
  3. However, if you get past this issue, after about an hour, the websocket will lose connection and the realtime client will be invalid. I’ve tried to re-authenticate in this situation and it didn’t work so this is the part I’m still trying to fix. You can speed up testing this by running ‘systemctl restart nakama’ on your linux server to cause the websocket to drop earlier, though.

I’ve got to say I’m a bit concerned that something considered production ready is this problematic.

Here is my CheckTokenExpiry function:

And, my expiry check timer:

My GatherDeviceId function just spits out a fake device name string for testing purposes. I added the function to BPL_Nakama in NakamaBlueprintsDemo/NakamaDemo/Blueprints/Core. For your testing purposes here it is:

Provide it with a serial id. You can store this in the NakamaDemoController and make it Public, then use the same value anytime you feed it into the gather (later replace this with the actual device information, however make certain when you do to sign the waiver privacy forms from your respective console / platform):

Note: My expiry checker reauthenticates using the device, you could change this to email or whatever authentication you prefer. I linked the device id on login so I could reauthenticate later without needing to supply the login details again with just the device id. Which btw does work and isn’t related to the 1+ hour websocket error.

Another note: I StartExpiryTimer right before SetupRealtimeClient is called in the Event On Authenticated.

If you want to be able to use a device for login in WBP_Login rewrite the Authenticate with Email section with the following, note that all I did was splice in a call to my Gather Device Id function and then call Link Device:

Oh, and forgot to provide my IsAuthTokenExpiredSoon:

Edit: Added a random number to the gather device id so you can test multiple players locally. Made it serial and set only once in the controller per run.

Yes, sorry to answer your question the Joins and Leaves are available from that event. You’ll notice I was printing out the user name of the joiners in a loop, but you can do anything with the information about who is joining and leaving. If you’re using the template, they have an event for handling it already but they mis-typed the comment header for the Leaving section (both say joining).

Also, I managed to fix the transport error caused if the connection drops. Not sure if this is the right way to do it, but I had to create a whole new client:

Later on in the on authenticated event I check if the timer handle is valid but not active, and then unpause it otherwise I start a new timer for the expiry check.

Note: Also, I confirmed the binds have to happen in the On Authenticated because the previous realtime client gets trashed and recreated so the binds have to occur again.

I found a new bug too, if you’re currently in a chat room when the connection is lost then it doesn’t reconnect to the chat and there is no way to force a reconnection to the chat in the user interface. The same problem happens with the Party system, so the state of everything has to be corrected and unfortunately the template doesn’t take care of that.

Consider any code or blueprints I release on the forums to be licensed under MIT license and feel free to make use of them.

Thank you so much brother.

There is also a join/leave event specific to matches themselves.