Knowing when a connexion fails with Photon Realtime

Hi,

I am trying to make a turn-based game like chess. I have already implemented the gamefor one player in Unity. For networking, I have started to use Photon Realtime since I want to use webhooks in the future to keep persistent rooms. I have also looked at the memory demo as well as the PUN basics and PUN RPS demo.

I would like to deal with connexion problems when I connect to the server, but it seems that ConnectToRegionMaster returns true even when there is connexion, ie. isConnectionSent is true for:

bool isConnectionSent = GameClientInstance.ConnectToRegionMaster(regionId);

How do I know if the connexion truly succeeded ? Is there a demo treating these cases ?

Thank you.

Answers

  • you would use

    public void OnConnectedToMaster()
    {
    Debug.Log("Successfully connected to the master server.");
    }
  • There is a tutorial, which you should follow through:
    https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial/intro

    That should cover it.
  • Thank you for the quick replies.
    Unfortunately, I am still confused. I did the tutorial but it assumes we use PUN, whereas I am using Photon Realtime to be able to use webhooks in the future. So I have a GameClient which inherits from LoadBalancingClient (as it is for the MemoryGameClient) whereas in the basic tutorial, the Launcher inherits from MonoBehaviourPunCallbacks. So it seems I am not allowed to override OnConnectedToMaster since I do not derive from MonoBehaviourPunCallbacks. Where am I wrong ?
Sign In or Register to comment.