Heartbeat with RaiseEvent not reliable
Hi
I am using Raise Event for heart beat to detect if player is active but there are some problems as after some time I got timeout because the message is not received in time.
I send this event every 1.5 sec. My client has a low timeout requirement and I know that this may result in false positives.
What is your recommendation?
Should i use PhotonViewSerialization
I am using Raise Event for heart beat to detect if player is active but there are some problems as after some time I got timeout because the message is not received in time.
I send this event every 1.5 sec. My client has a low timeout requirement and I know that this may result in false positives.
What is your recommendation?
Should i use PhotonViewSerialization
0
Comments
-
Hi @Eduard,
What is the problem exactly with using RaiseEvent as a heartbeat?
There is no perfect solution!
Only trade-offs, tweaking and optimization until we reached an OKish situation that gives a good enough user experience.RaiseEvent not reliableas after some time I got timeout because the message is not received in time
You could also make the timeout value dynamic depending on those factors.
You can relax the timeout or polling period.this may result in false positives
You could add an extra event to ask the actor if he's still active...
so after a potential timeout of actor X based on the heartbeat logic, the master client (or another actor) can send a special event to actor X and wait for his answer (to confirm he's inactive).
PhotonViewSerialization uses RaiseEvent internally also.0 -
Hi @JohnTube
The game is not to heavy in network messages but after some time without touching anything it detects the timeout. The last timestamp when pong event is received is stored so RTT do not affect the disconnection.
Your last point is actually a great idea but it adds up to the delay of detecting the disconnection.
I thought that PhotonStream could resolve that
Do you think it is a bad practice if I raise events at scale of milliseconds? like 700ms udp?0 -
Do you think it is a bad practice if I raise events at scale of milliseconds? like 700ms udp?0