Internet connection issues
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Internet connection issues
Maheshk_218
2018-12-22 11:09:09
Hi , We have integrated PUN for one of our game. We are facing some issues related to internet connection.
Player 1 and Player2 connected in one of the PvP game. Some time later Player 1 lost internet connection for 3 seconds and came back. Player2 got an event immediately after player1 lost connection, but player1 didn't received any event related to failure connection immediately (Received after 60 sec), and for player1 still showing connected TRUE.
Other issues is even after player1 got internet connection , message passing is not happening between two players.
Comments
Hi @Maheshk_218,
Thank you for choosing Photon!
You also sent us an email regarding this.
I will reply here as well and I think we should continue the discussion here:
PhotonNetwork.Reconnect()
) and rejoining the room if necessary (PhotonNetwork.ReconnectAndRejoin()
).
If you think that PUN client state is not correct and not reliable, here is what I suggest:
send us the repro env. details and minimal repro steps:
- PUN version
- Unity version
- description of the issue: e.g. expected behavior vs. the actual behavior you see
You could increase log levels, add SupportLogger component and send us logs.
Also, make sure to implement disconnection callbacks and log the disconnection cause/reason.
Otherwise, here are some documentation links:
- Mobile Background Apps
- Client Connection Handling
- Analyzing Disconnects
- Master Client and Host Migration
Hi @JohnTube,
Thanks for replying.
Also, this 60 Secs of Background timeout will work for both Android/iOS?
Is there any suggested way to handle all Disconnect/Reconnect events?
Hi @ajaybirla,
Thank you for choosing Photon!
I'm assuming you work with @Maheshk_218.
1- Implement the proper disconnection callback
2- For iOS you could handle this using Unity's
OnApplicationPause
by explicitly/manually disconnecting and reconnection. See Unity RunInBackground.3- Add an early timeout detection heuristics and manually force client disconnection/reconnection...Take a look at this post by my colleague here
You cannot change server timeout window for Photon Cloud but I think you could do it for self-hosted Photon Server (see here).
Maheshk_218
2018-12-27 07:53:41
Hi @JohnTube ,
Thanks for your responses.
When player1 lost the connection, is there any way to send the buffered messages from player2 after reconnection. (ie while PvP game if one player lost the connection , then how to store the buffered messages and send it back when both reconnected again. did photon has an options store the buffered messages or we need to manually store and send them back on reconnection).
I know there is buffered RPC's but want to know wether it will work in above scenarios.
Hi @Maheshk_218,
Buffered RPCs (which are Cached Events under the hood) are resent on reconnection yes.
You may need to clean up RPCs or events not needed anymore or filter those already received and processed if you get duplicate events on rejoin...
Maheshk_218
2018-12-29 14:17:55
@JohnTube I am looking for RPC's that happened only after player disconnect. But Photon have system to recieves all the RPCs from the begining of the game. So for now we achieved this by having MasterClient to send the buffered RPC's to re-connected player by cacheing them manually.
Back to top