private void ReplyClose(IUserToken ut, QueueResult data) { var qcoder = (QUnpacker)ut.Unpacker; _serverSokcet.Send(ut.ID, qcoder.QueueCoder.Close(data.Name)); _exchange.Clear(ut.ID); _serverSokcet.Disconnecte(ut.ID); }
public void Disconnect(string sessionID) { try { // _server.Disconnecte(_server.GetCurrentObj(sessionID)); _server.Disconnecte(sessionID); } catch (Exception ex) { log4j.Error(sessionID, ex); } finally { ushort index = sessionIDToNumber.Get(sessionID); sessionIDToNumber.Remove(sessionID); } }
public void Disconnecte(IUserToken userToken) { _serverSokcet.Disconnecte(userToken); }
internal void Disconnect(IUserToken userToken) { _server.Disconnecte(userToken.ID); }
private void _server_OnReceive(object currentObj, byte[] data) { var mUserToken = (MessageUserToken)currentObj; mUserToken.Unpacker.Unpack(data, (s) => { if (s.Content != null) { try { var cm = SerializeHelper.PBDeserialize <ChatMessage>(s.Content); switch (cm.Type) { case ChatMessageType.Login: ReplyLogin(mUserToken, cm); break; case ChatMessageType.Subscribe: ReplySubscribe(mUserToken, cm); break; case ChatMessageType.UnSubscribe: ReplyUnsubscribe(mUserToken, cm); break; case ChatMessageType.ChannelMessage: ReplyChannelMessage(mUserToken, cm); break; case ChatMessageType.PrivateMessage: ReplyPrivateMessage(mUserToken, cm); break; case ChatMessageType.CreateGroup: ReplyCreateGroup(mUserToken, cm); break; case ChatMessageType.AddMember: ReplyAddMember(mUserToken, cm); break; case ChatMessageType.RemoveMember: ReplyRemoveMember(mUserToken, cm); break; case ChatMessageType.RemoveGroup: ReplyRemoveGroup(mUserToken, cm); break; case ChatMessageType.GroupMessage: ReplyGroupMessage(mUserToken, cm); break; default: throw new Exception("未知的协议"); } } catch (Exception ex) { _server.Disconnecte(currentObj); LogHelper.Error("MessageServer._server_OnReceive", ex); } } }, null, null); }
/// <summary> /// 发送关闭 /// </summary> /// <param name="id"></param> /// <param name="data"></param> public void Disconnect(string id, WSProtocal data) { ReplyBase(id, data); _server.Disconnecte(id); }