Different SenderId on ListNotificationsAsync & socket.ReceivedNotification

whenever an online player receive chat message from a channel that is not joined yet, receive this notification from socket.ReceivedNotification:

Notification Received, code:-1, SenderId:[otherPlayerUserId], subject:[otherPlayerUsername] wants to chat, content:{"username":"[otherPlayerUsername]"}

but when player tries to get notifications with ListNotificationsAsync (for example after connection) the same notification is:

Notification Received, code:-1, senderId:[SelfUserId], subject:[otherPlayerUsername] wants to chat, content:{"username": "[otherPlayerUsername]"}

i want to get otherPlayerUserId on getting notification by ListNotificationsAsync, for now i have to use client.GetUsersAsync for each notification with code -1 to join chat with him on direct message scenario.
Nakama Version: 3.17.1+258a7f35

  1. explore filtering the notifications based on specific criteria. Here’s an approach:
  • Implement a check on the notification’s content field when using ListNotificationsAsync. Look for the presence of the "username" key and extract the actual username from the content.
  • If the content field has a "username" key, proceed with identifying the other player and handling the join request logic.
  • If the notification isn’t related to a join request (doesn’t have a "username" key), handle it as a standard notification from another user.

Example Code (Filtering Approach):

async Task HandleNotifications()
var notifications = await client.ListNotificationsAsync();
foreach (var notification in notifications)
if (notification.Code == -1 && notification.Content.TryGetValue(“username”, out string username))
// Other player is trying to join a chat you’re not in
// Extract otherPlayerUserId from notification or other logic
// Handle the join request logic (e.g., join the channel)
// Standard notification from another user
// Handle the notification based on its content

If your holiday is gaming, and this is PoE, then you are very lucky that I am here, and I advise you to use this service to boost you everything you can want in PoE, quickly and ultra-reliably, because the service has almost 5 thousand positive reviews!!!