Is there anyway I can know when a player got offline?
I want to notify his/her friends when he/she got offline, so they cannot be invited to a play together anymore
Is there anyway I can know when a player got offline?
I want to notify his/her friends when he/she got offline, so they cannot be invited to a play together anymore
Firstly, the login mechanism that PlayFab provides is stateless. Server-side won’t remember the user's login information. So, we can’t get the state that client’s online or offline. So we should use an external server-side mechanism to handle the online and offline state.
Secondly, there is no built-in API to share info between friends, group data only suits less than a dozen or so players and polling Player public data will over frequency limits, they are not very suitable for such cases.
Hence, a possible workaround is to make a custom server to handle the players’ if-online state. PlayFab provides the server hosting service Multiplayer Server 2.0, it is available to PlayFab indie, pro, and enterprise-tier customers. Use this service you can host your custom server executable on the PlayFab.
You can implement a basic forwarding server. Let the clients establish a long connection with it when they log in. Use a heartbeats mechanism to detect client connection status then broadcast to every client who connects with it. All in all, you need to build a simple server-side program by yourself to implement the feature you want.
2 People are following this question.