Example #1
0
        public void ToSuccess(SuperWebSocket.WebSocketSession session, int type, string json)
        {
            json = new Security().Decrypt(json);

            byte[] _sendBuffer = new byte[Buffer.HEADER_SIZE + Buffer.SEND_BUFFER_SIZE];
            byte[] _data       = Encoding.UTF8.GetBytes(json);
            BitConverter.GetBytes(type).CopyTo(_sendBuffer, Buffer.PACKET_TYPE_OFFSET);

            _data.CopyTo(_sendBuffer, Buffer.HEADER_SIZE);
            session.Send(_sendBuffer, 0, Buffer.HEADER_SIZE + _data.Length);
        }
Example #2
0
        public void SendToClient(SuperWebSocket.WebSocketSession reciveSession, Message message, string value)
        {
            if (reciveSession != null)
            {
                reciveSession.Send(value);
                message.IsProc     = true;
                message.IsRead     = true;
                message.IsRecived  = true;
                message.SendTime   = DateTime.Now;
                message.ReciveTime = DateTime.Now;
            }
            else
            {
                message.SendTime   = DateTime.Now;
                message.ReciveTime = DateTime.MaxValue;
            }
            AsyncWriteMessage awm = new AsyncWriteMessage(WriteMessage);

            awm.BeginInvoke(message, null, null);
            //any more
        }