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