How ban accounts properly and get notified?

Good day everyone! Please, help me understood how the bun account feature works from nakama console. I got the nakama server with default configuration from the HeroicLabs getting starting guide, installation section, from docker, with default postgres configuration that you suggested. Read the SDK and wrote simple client in c++(the code is below), as I can understand the SDK. After that I see, it can register(with true on create flag in authenticateEmail call), connect and handle simple events from my nakama instance. After I launch my client, I go to console, see 2 Presences for my one client instance.

Seems I found the issue related to this problem.

The first question is about 2 Presences per 1 Session: is my client is bad designed, or nakama calculates client and rtClient as different Presences for one session?

The second question is: launch the client, go to nakama console Accounts section(heading as User Accounts), open my active myUserName1 account and ban it with pressing Ban button. There is no event notification sends to client, and you can see still active session in section Status, fields Sessions = 1 and Presences = 2. I inspect little bit runtime func BanUsers in server/core_user.go and can’t be sure it really close the session. How to ban users properly? Is this a bug of server runtime?

  1. Versions: Nakama {3.15}, {Docker}, {C++, 2.7.2}
  2. Server Framework Runtime language (If relevant) {Go, TS/JS, Lua}

here is my client code at pastebin
this is my attempt to fix this problem at pastebin, is it appropriate to be approved and I can make pull request, or it should be done different way?

Hello @shprot,

To reply to your first question - the number of presences in Nakama don’t translate to the number of connected clients, so it’s normal that you may see more than one per client.

For the second question, you’re right, the Ban functions currently do not disconnect the user, we’ll improve on this in the next release, a PR is being worked on.

Best

1 Like

Reviewed your PR, and I can’t see that your code sending a message to the client, that contain kind of disconnection reason: some defined code or message. It’s need to show player in-game notification, is it possible to determine that in a client with your change?

The PR has since changed and a new notification is included when the user is banned, the PR is already merged.

Yeah, already checked your PR recently. Thank you very much for that fix!

1 Like