Socket connect and disconnect

I wan to track when player open the game that means when they connected to the server and also when they disconnected to the server

Any example with typescript. I did researched about one week i could get it.
so guys please help.

Hello @developerdinno,

Have a look at: Events - Heroic Labs Documentation, however these can only be processed with some custom Go code, you can set this up in Go and use typescript for your other custom RPCs and/or match handlers, as the runtimes are interoperable (but cannot be invoked from each other).

Hope this helps.

Thank you sir for your reply.
Here i am using typescript

Image
registry.heroiclabs.com/heroiclabs/nakama:3.21.0

packing.json
{
…,
“nakama-runtime”: “github:heroiclabs/nakama-common#master”,
}

and according to your suggested document I don’t have
initializer.RegisterEventSessionEnd

please give me how can i handle the when player disconnect with internet not in match on just opening the game

JS and Lua are not supported for the aforementioned APIs, you’ll have to use Go. I’m not sure I understand what advice you’re asking for, can you elaborate on what you’re trying to achieve?

I want to track the player session when the player open the game and when player closed or disconnect to the server (internet goes)

Then yes the suggested approach is best, for now you’ll need to rely on the Go runtime, you can use it specifically to handle these events but still use JS for anything else.

Hope this helps.

Thank you for your suggestion.
I want to know how to nakama handle online status of the player how can is get that from database

Presences and player status are not stored in the database and are handled in-memory. You can access a player status through the user and friend APIs or using streams.