Why am I not connecting to Photon Chat but rather disconnecting

Options
ChethanV007
edited January 2022 in Photon Chat

Hi I am trying to connect to Photon Chat but I am not able to connect to it. Rather I am getting disconnected. If I don't put the

 if(chatclient!=null)
      chatclient.Service();

in the Update loop, it is not getting disconnected, but rather not getting connected as well. Well this is my code

using ExitGames.Client.Photon;
using Photon.Chat;
using Photon.Pun;

  void Start()
    {      
        if (string.IsNullOrEmpty(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat))
            Debug.Log("no CHat app ID provided");
        ConnectToPhotonChat();
    }

 private void ConnectToPhotonChat()
    {
         chatclient = new ChatClient(this);
         chatclient.ChatRegion="in";
         chatclient.Connect(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat,PhotonNetwork.AppVersion,
         new Photon.Chat.AuthenticationValues(nickname));
        Debug.Log("Connect to Photon Chat");      
    } 
 void Update()
    {
    if(chatclient!=null)
      chatclient.Service();//in the update so that I constantly is connected and receiving messages
    }
 public void OnDisconnected()
    {
        Debug.Log("You have disconnected from the Photon Chat........");
       
    }

    public void OnConnected()
    {
        Debug.Log("You have successfully connected to the Photon Chat.......");
          chatclient.SendPrivateMessage("chethan7", "INVITE......");
    }


Actually speaking in the console "You have successfully connected to the Photon Chat.......",which is the one which gets executed when you successfully connect to Photon Chat should be executed.Here is the look of the console:


Best Answer

Answers