protected override void OnReceive(MessageEventArgs e) { // Api解码消息得到Action和参数 var msg = e.Message; if (msg.Reply) { return; } var rs = _ApiHost.Process(this, msg); if (rs != null) { Session.SendAsync(rs); } }
protected override void OnReceive(ReceivedEventArgs e) { LastActive = DateTime.Now; // Api解码消息得到Action和参数 var msg = e.Message as IMessage; if (msg == null || msg.Reply) { return; } var rs = _Host.Process(this, msg); if (rs != null) { Session?.SendMessage(rs); } }
protected override void OnReceive(ReceivedEventArgs e) { LastActive = DateTime.Now; // Api解码消息得到Action和参数 var msg = e.Message as IMessage; if (msg == null || msg.Reply) { return; } // 连接复用 if (_Host is ApiServer svr && svr.Multiplex) { ThreadPoolX.QueueUserWorkItem(m => { var rs = _Host.Process(this, m); if (rs != null) { Session?.SendMessage(rs); } }, msg); }