So I tested sending notification while the user is offline. One is friend invitation and the other one is a private message. Weird thing is that the user is only got the friend invitation one. I even Debug.Logged any notifications and yea only got that one. Anyone can explain?
Edit:
Sometimes the ReceivedNotification callback also doesn’t get called. Could it be the server things?
PendingNotifications = await _client.ListNotificationsAsync(_session, 100);
Debug.Log($"Cursor?: {PendingNotifications.CacheableCursor} | {PendingNotifications.Notifications.Count()}");
if (!string.IsNullOrEmpty(PendingNotifications.CacheableCursor))
{
Debug.Log("Cursor2?");
PendingNotifications = await _client.ListNotificationsAsync(_session, 100, PendingNotifications.CacheableCursor);
Debug.Log($"Cursor3? {PendingNotifications.Notifications.Count()}");
foreach (var n in PendingNotifications.Notifications)
{
Debug.Log($"Subject '{n.Subject}' content '{n.Content}'");
}
}
In Cursor? the count is 7 then when it reached the Cursor3? it becomes 0. I’m pretty sure I’ve followed the documentation here
Hello @aliakbarm534,
We’re not aware of any issue with the notification delivery system. I suspect that you’re setting up the callbacks in a non-deterministic way such that sometimes they’re not set before a notification message is received by the socket and sometimes it is.
Notifications are only sent to the socket of online players and will only be retrievable offline if the persist
flag is set to true when sending the notification. After the client has received a persisted notification via the socket, it should delete it to prevent it from being consumed again using ListNotificationsAsync
(see delete-notifications).
The cacheable cursor is meant to allow the client to resume fetching only any new or unseen notifications while offline. In your example you’ve fetched all new notifications on the first call and use the returned cursor in the following call, which will yield no results unless new notifications have been persistend in between.
Hope this clarfies.