You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, how shall I check if player is still online? Should I use onTick method to send heartbeat signal (for example with ctx.broadcastEvent) and wait for response and store it?
Thanks in advance :>
The text was updated successfully, but these errors were encountered:
I think the easiest way to do this would be to have a latestHeartbeatTimestamp field in your internal state per player, and have the client call a heartbeat method which sets the timestamp.
Then in getUserState you can compute whether someone is online or not based on the difference between the current time and the latestHeartbeatTimestamp per player. How does that sound?
If you wanted to specifically remove a player from the internal state if they haven't sent a timestamp for a certain period of time, then I would do that inside onTick
Hi, how shall I check if player is still online? Should I use onTick method to send heartbeat signal (for example with ctx.broadcastEvent) and wait for response and store it?
Thanks in advance :>
The text was updated successfully, but these errors were encountered: