public WSProtocal(WSProtocalType type, byte[] content) { this.Type = (byte)type; if (content != null) this.BodyLength = content.Length; else this.BodyLength = 0; this.Content = content; }
private void ReplyBase(string id, WSProtocalType type, byte[] content) { var bs = new WSProtocal(type, content); ReplyBase(id, bs); }
/// <summary> /// 发送数据到wsserver /// </summary> /// <param name="msg"></param> /// <param name="type"></param> public void Send(byte[] msg, WSProtocalType type = WSProtocalType.Text) { var data = new WSProtocal(type, msg).ToBytes(); base.Send(data); }
private void ReplyBase(Stream stream, WSProtocalType type, byte[] content) { var byts = new WSProtocal(type, content).ToBytes(); stream.Write(byts, 0, byts.Length); }
private void ReplyBase(WSUserToken ut, WSProtocalType type, byte[] content) { var byts = new WSProtocal(type, content).ToBytes(); base.SendAsync(ut.ID, byts); }
private void ReplyBase(string id, WSProtocalType type, byte[] content) { var byts = new WSProtocal(type, content).ToBytes(); _server.SendAsync(id, byts); }
/// <summary> /// 发送数据到wsserver /// </summary> /// <param name="msg"></param> /// <param name="type"></param> public void Send(byte[] msg, WSProtocalType type = WSProtocalType.Text) { var data = new WSProtocal(type, msg).ToBytes(); _client.SendAsync(data); }