How to resend commands generated before reconnecting to room?
Options
Hi.
I have problem with client resending his outgoing commands queued before it realizes that connection has been timed out.
Use case goes like this:
- client joins room
- game starts loading new scene and sets
- client loses connection for brief second (switches wifi off and on or something like that). This breaks connection between client and my server.
- scene finishes loading and resumes message queue.
- client spawns some networked GameObjects before realizing connection is broken
- client timeouts and tries to reconnect to server causing queue of outgoing commands to be cleared
- client reconnects and rejoins the room but "NetworkInstantiate" commands are now lost so the objects never spawn for other clients
An oblivious solution would be to resend the lost commands but I can't find an easy way to do that.
My question is: Is there any way to access queue of commands awaiting to be sent before it gets cleared or do I have to implement some sort of command caching and indexing?
I'm a bit hesitant on implementing the second solution since it will increase size of all important commands packets so maybe there is some better solution?
I have problem with client resending his outgoing commands queued before it realizes that connection has been timed out.
Use case goes like this:
- client joins room
- game starts loading new scene and sets
PhotonNetwork.IsMessageQueueRunning
to false- client loses connection for brief second (switches wifi off and on or something like that). This breaks connection between client and my server.
- scene finishes loading and resumes message queue.
- client spawns some networked GameObjects before realizing connection is broken
- client timeouts and tries to reconnect to server causing queue of outgoing commands to be cleared
- client reconnects and rejoins the room but "NetworkInstantiate" commands are now lost so the objects never spawn for other clients
An oblivious solution would be to resend the lost commands but I can't find an easy way to do that.
My question is: Is there any way to access queue of commands awaiting to be sent before it gets cleared or do I have to implement some sort of command caching and indexing?
I'm a bit hesitant on implementing the second solution since it will increase size of all important commands packets so maybe there is some better solution?
0
Best Answer
-
Hi @Blue_,
Thank you for choosing Photon!
The queue of commands is in the library level (PhotonPeer).do I have to implement some sort of command caching and indexing?I'm afraid you need to add a custom layer on top for this.
[...]so maybe there is some better solution?
Unless @Tobias has another opinion about this.5
Answers
-
Hi @Blue_,
Thank you for choosing Photon!
The queue of commands is in the library level (PhotonPeer).do I have to implement some sort of command caching and indexing?I'm afraid you need to add a custom layer on top for this.
[...]so maybe there is some better solution?
Unless @Tobias has another opinion about this.5 -
At least it's not hard to implement
Thanks for the answer!0