Subscribe doesn't work

OnConnected() is working fine, but when I go to subscribe on a channel, OnSubscribed() is not called
The Code:
using UnityEngine;
using Photon.Chat;
using ExitGames.Client.Photon;
using Photon.Pun;

public class GameChat : MonoBehaviour, IChatClientListener
    ChatClient chatClient;
    [SerializeField] string userName;

    void Awake()
        userName = PhotonNetwork.NickName;

    void Start()

    void Update()

    void ConnectToPhotonChat()
        chatClient = new ChatClient(this);
        chatClient.ChatRegion = "SA";
        chatClient.Connect(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat, PhotonNetwork.AppVersion, new AuthenticationValues(userName));

    void SendDirectMessage(string message)
        chatClient.PublishMessage("global", message);

    public void SendPublicMessage()
        if (!string.IsNullOrEmpty(inputMessage.text))
            inputMessage.text = "";

    public void OnConnected()
        Debug.Log("Chat: Is Connected!");

        chatClient.Subscribe(new string[] { "global" });

    public void OnDisconnected()
        Debug.Log("Disconnected From The Chat!");

    public void OnSubscribed(string[] channels, bool[] results)
        Debug.Log("Subscribed on Channel!");

    public void OnUnsubscribed(string[] channels) 
        Debug.Log("Not Subscribed!");


  • JohnTubeJohnTube mod
    edited June 7
    Hi @Crazy_Ozz,

    Thank you for choosing Photon!

    Do you see any errors in the logs?
    Do you have webhooks enabled for the AppId?
    Check return value of Subscribe call.
    Maybe the client disconnects before subscription finishes?
  • I don't receive none error
    What is webhook?
    Doesn't return
    And the client don't disconnected, stay connected
  • JohnTubeJohnTube mod
    edited June 8
    Chat Webhooks.
    If you try another channel name does the subscribe succeed and you get callback?
    If you try to publish a message after calling subscribe does it work?

    Maybe you are switching scenes or disabling component or deactivating its GameObject which would cause Update to not being called and by consequence the callback to not trigger?
  • I tried another name in channel but nothing happens
    Publish a Message is not being called because I can't subscribe

    I checked everything you said, but my App ID Chat and App ID Pun are the same, that would be the problem?
  • I checked everything you said, but my App ID Chat and App ID Pun are the same, that would be the problem?
    yes that's it, that's the problem.
    You need a Chat AppId, PUN and Chat App types are not interchangeable.
  • Ok, another problem, I create a Photon Chat on Photon Cloud, I put the ID on Photon Chat (in Unity) and now I always disconnect from the chat
  • Check logs.
    Photon Chat does not have "SA" region but only three regions.
    See here.
  • Thanks, Thank you for the patience, it's working now
Sign In or Register to comment.