Chat not working in WebGL

Hi,

I am getting error on trying to connect to photon chat on WebGl platform(This runs fine on standalone builds)

Connect failed. SocketImplementationConfig is null for protocol WebSocketSecure: {(ConnectionProtocol)Udp=(MonoType)ExitGames.Client.Photon.SocketUdp, (ConnectionProtocol)Tcp=(MonoType)ExitGames.Client.Photon.SocketTcp}
UnityEngine.Debug:LogError(Object)
ChatNewGui:DebugReturn(DebugLevel, String) (at Assets/Demo Chat/ChatNewGui.cs:317)
ExitGames.Client.Photon.Chat.ChatClient:ExitGames.Client.Photon.IPhotonPeerListener.DebugReturn(DebugLevel, String) (at Assets/PhotonChatApi/ChatClient.cs:800)
ExitGames.Client.Photon.<>c__DisplayClass145_0:b__0()
ExitGames.Client.Photon.TPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.Chat.ChatClient:Service() (at Assets/PhotonChatApi/ChatClient.cs:269)

I have already tried all the solutions listed on forums

Made sure to set the connection protocol to WebSocketSecure(Did not work)

this.chatClient = new ChatClient(this,ExitGames.Client.Photon.ConnectionProtocol.WebSocketSecure);
bool isConnecting = this.chatClient.Connect("XYZ", "1.0", new ExitGames.Client.Photon.Chat.AuthenticationValues("UerrName"));


Changed the code inside Chat Peer to fetch "WebSocketType" (Did not work)

websocketType = websocketType ?? Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp", false);
websocketType = websocketType ?? Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp-firstpass", false);


Unity Version : 2018.2.11f1
Photon Unity Networking 2 Version 2.2

Thanks in advance...

Answers

  • Are you set your chat ID in PhotonServerSettings ?
  • Feelkep
    Feelkep
    edited August 2019
    Try it :
         
    public string yourMessage = "HelloWorld!";
    void SendMsg(){
    GetComponent<PhotonView>().RPC("ChatMess", PhotonTargets.All, yourMessage);
    }
    [PunRPC]
    void ChatMess(string message){
    GameObject playerMessage = PhotonNetwork.Instantiate("PhotonMessage", Vector3.zero, Quaternion.identity, 0);
    playerMessage.GetComponentInChildren<Text>().text = transform.name + " : " + message;
    playerMessage.transform.SetParent(GameObject.Find(ChatPanel.name).transform);
    }