Skip to main content

Cancel Channel Subscription

Cancels a subscribed channel.

Call Information

UnSubscribe(string channelId) {}

Call Details

ParameterDescriptionType
channelIdSubscription channel IDstring

Callback Method Information

public void OnUnSubscribed(ChatInfoModel chatInfoModel) {}

ChatInfoModel Class Details

The ChatInfoModel Class contains information about the channel and user who sent the message.

Data KeyDescriptionType
gameIdGame IDstring
channelIdChannel IDstring
userUniqueIdUser IDstring
userNameUser namestring

Source Code

using UnityEngine;
using PlayNANOO.ChatServer;
using PlayNANOO.ChatServer.Models;

public class PlayNANOOChatExample : MonoBehaviour, IChatListener
{
ChatClient chatClient;

void Start()
{
chatClient = new ChatClient(this);
chatClient.SetPlayer("USER_ID", "USER_NAME");
chatClient.Connect();
}

public void OnConntected()
{
chatClient.Subscribe("CHANNEL_ID");
}

public void OnSubscribed(ChatInfoModel chatInfo)
{
chatClient.UnSubscribe("CHANNEL_ID");
}

public void OnUnSubscribed(ChatInfoModel chatInfo)
{
Debug.Log("Success");
}
}