跳转到主要内容

消息接收

要接收实时消息,需要持续触发事件。 如果消息接收事件未执行,则无法接收用户的消息。

调用信息

Service() {}

源代码

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();
}

void Update()
{
if (chatClient != null)
{
chatClient.Service();
}
}
}