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 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?

Best Answer

Answers

  • Blue_
    Options
    At least it's not hard to implement :)
    Thanks for the answer!