Example #1
0
 public WSProtocal(WSProtocalType type, byte[] content)
 {
     this.Type = (byte)type;
     if (content != null)
         this.BodyLength = content.Length;
     else
         this.BodyLength = 0;
     this.Content = content;
 }
Example #2
0
        private void ReplyBase(string id, WSProtocalType type, byte[] content)
        {
            var bs = new WSProtocal(type, content);

            ReplyBase(id, bs);
        }
Example #3
0
        /// <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);
        }
Example #4
0
        private void ReplyBase(Stream stream, WSProtocalType type, byte[] content)
        {
            var byts = new WSProtocal(type, content).ToBytes();

            stream.Write(byts, 0, byts.Length);
        }
Example #5
0
        private void ReplyBase(WSUserToken ut, WSProtocalType type, byte[] content)
        {
            var byts = new WSProtocal(type, content).ToBytes();

            base.SendAsync(ut.ID, byts);
        }
Example #6
0
        private void ReplyBase(string id, WSProtocalType type, byte[] content)
        {
            var byts = new WSProtocal(type, content).ToBytes();

            _server.SendAsync(id, byts);
        }
Example #7
0
        /// <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);
        }