Skip to main content

Channel Subscription

PlayNANOO chat service lets user groups or topics use channels.
Subscribers to a channel receive all public messages.

Call Information

Subscribe(string channelId) {}
Subscribe(string channelId, short prevMessageCount) {}

Call Information Details

ParameterDescriptionType
channelIdSubscription channel IDstring
prevMessageCountNumber of past messages to querystring

Callback Method Information

public void OnSubscribed(ChatInfoModel chatInfoModel) {}

ChatInfoModel Class Information Details

ChatInfoModel Class stores details about the channel and the message sender.

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)
{
Debug.Log("User Joined");
}
}