Unsubscribe from Channel
Explains how to leave (unsubscribe from) a specific channel.
Description
Leave a specific channel by calling the ChatManager.Instance.Unsubscribe() method. After leaving, you will no longer receive messages from that channel.
Method Information
| Item | Content |
|---|---|
| Method | ChatManager.Instance.Unsubscribe(string channel) |
| Callback | OnUnSubscribed(ChatUserInfo user) - Called when user leaves |
Parameters
| Parameter | Type | Description |
|---|---|---|
| channel | string | Channel name to unsubscribe from |
Unity C# Usage Example
using UnityEngine;
public class ChatExample : MonoBehaviour, IChatListener
{
private string myChannel = "Default Channel";
public void ExitChannel()
{
ChatManager.Instance.Unsubscribe(myChannel);
}
public void OnUnSubscribed(ChatUserInfo user)
{
Debug.Log($"{user.visitorName} left");
}
// ... Other IChatListener method implementations
}