How to get the time lapsed without server communication.

Options
Hi

Is there any way to get the time lapsed since the client's last successful ping/communication with photon server? (whatever you use to detect StatusCode.TimeoutDisconnect, the client timeout disconnect).

I'm implementing a way of detecting inactive characters, but I get false positives when I'm the one who loses the connection but I haven't yet received the connection fail event, since I can't receive data from other players. Basically I want to players who have been inactive less time that the time lapsed since the last successful ping.

Thanks.

Comments

  • huhund
    Options
    I see that this question was asked a long time ago. But I will still try to bump it because I think I have the same question.

    * My use case is that I want a warning 5 seconds after having trouble getting data from the server. *

    I know that the OnDisconnectedFromPhoton will be called after 10 seconds (i.e. the default time out). But I want a warning to show to the player before this happens.

    Unless I'm wrong I can't use the Ping because this is not updated unless I actually can reach the server. What would work for me is to know when was the last package received from the server. I assume photon internally uses something like this anyway when doing the timeout for disconnected. Can I find this timestamp somewhere?

    Best, Hu
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Jabefa,

    Hi @huhund,

    Thank you for choosing Photon!

    Sorry for the late reply I have been searching forum topics about early client timeout detection and stumbled across this, Maybe the info in this post is useful?