Hello,
We are building a prototype based on Nakama. One of the requirements is to send a push notification when user comes online. There is a build-in event session_started, which is genuinely what we want. At the same time the handlers for the event, unlike other Nakama handlers, don’t have neither database, nor the runtime module provided.
What is the expected way to enrich the user information in this case? Even with the external analytics, which is supposed to be the primary usage as I understand, user ID may not be enough. Could you recommend?
Thanks a lot!
2 Likes
Hi @f1avalanche welcome
What is the expected way to enrich the user information in this case? Even with the external analytics, which is supposed to be the primary usage as I understand, user ID may not be enough. Could you recommend?
We don’t expose the database pool or the Nakama module into the SessionStart
and SessionEnd
event. This is to encourage developers to avoid the use of those APIs in case they cause an IO storm from a stampeding herd (mass disconnect and reconnect scenario) with game clients and don’t implement a rate limiter pattern.
There is a way to utilize these types in the runtime if you need it and know how to implement the right patterns to protect your code. You can see an example of it on this forum post:
RegisterEventSessionEnd with full functionality - #2 by novabyte
Hope that helps.
Hi @novabyte , thanks for the welcome and for the clear answer of yours!
That makes total sense, I agree with you being so cautious. Proneness to storm was also something I worried about. Would it make sense for an Advanced section of the documentation then? As I didn’t manage to find the said option even though I’d been looking for it.
Thanks again for you help, I appreciate!