// 发生信息附带函数
        public Task Emit(string eventName, object obj, ClientCallbackEventHandler callback)
        {
            return(Task.Run(() => {
                _PacketId++;

                string text = JsonConvert.SerializeObject(obj);

                string packetType = ((int)Protocol.Message).ToString() + ((int)Protocol.Ping).ToString();

                _EventTaget.On(_PacketId, callback);

                Send(Packet.GetMessagePacket(_Mode, packetType, _AbsolutePath, _PacketId, eventName, text)).Wait();
            }, _TokenSource.Token));
        }
Beispiel #2
0
 public void On(string eventName, GeneralEventHandler callback)
 {
     _EventTarget.On(eventName, callback);
 }