using System;
using UnityEngine;
using ZSocket;

/// <summary>
/// 监听消息， MsgType监听消息类型
/// </summary>
[MessageHandler(MsgType = "DEMO_MSG_REQ")]
public class DemoMessageHandler : AMessageHandler
{
    protected override void Handle(string msg)
    {
        Debug.Log($"Demo Handle Msg: {msg}");
    }
}

/// <summary>
/// 监听RPC消息，RecvMsgType为监听的消息类型，ReplyMsgType为回复的消息类型
/// </summary>
[RpcHandler(RecvMsgType = "DEMO_RPC_REQ", ReplyMsgType = "DEMO_RPC_RESP")]
public class DemoRpcHandler : ARpcHandler
{
    protected override void Handle(string inMsg, Action<string> reply)
    {
        Debug.Log($"Demo Handle Rpc: {inMsg}");

        reply.Invoke(inMsg);
    }
}

