How to send in-app notifications to all users in my server?

Need all users to send game messages from developer

@Raja_Nukala This can be a costly operation to perform because with games that have millions of players would require the entire dataset of user IDs to be pulled into memory to be processed for in-app notifications. The alternative is to use a batch-orientated API to send out the message to players in groups of 1000s of user IDs.

Do you have some example use cases for the type of messages you’d like to broadcast to all players in the game?

We’re also interested in this functionality, for things like server maintenance, or updates available. Grouping all user id’s in batches of 1000 makes sense, but how does the notification api work with multiple id’s? Is it simply a matter of looping through the id’s and sending one notification off at a time, or is there a way to pass the api multiple id’s? The documentation mentions sending notifications to “one or more” users, but I didn’t see a way to do that with the api docs.

Thanks

You can see in the runtime function reference the spec for nk.notifications_send which will send multiple notifications at once, but I wouldn’t use that for what you’re proposing.

I’d suggest something more like a RSS feed (or similar externally hosted resource) for update or maintenance notices. This will be visible to users even if their client can’t connect to the server anymore because the version is too outdated, or the server maintenance has already started and clients can’t connect to get the notification telling them about the maintenance in the first place.

1 Like

@zyro the link you provided does not point to that function,

Can you provide a new link?
Also do you know where I can find the list of available methods in the nakam lua runtime.
I tried to use nk.notificationSendAll() or nk.notification_send_all() but I get errors that I’m trying to call a non function.

thanks

No wonder if you are replying to a thread thats more than 2 years old :slight_smile:

Most likely you need to update your nakama server version as that function is fairly new.
It was introduced in v3.11.0

Oh and because you mentioned here would be the function reference:

1 Like

LOL just noticed.

yes I’m using 3.10 I will update it thanks

1 Like