示例#1
0
        public async Task <UInt64> Send(sdk.NetMessage msg)
        {
            UInt64 _id = 0;

            lock (this)
            {
                _id = this.sendMsgID;
                this.sendMsgID++;
            }
            msg.Params["_id"] = BitConverter.GetBytes(_id);

            wantsend.Enqueue(msg.ToBytes());
            return(_id);
        }
示例#2
0
        public async Task <UInt64> Send(sdk.NetMessage msg)
        {
            UInt64 _id = 0;

            lock (this)
            {
                _id = this.sendMsgID;
                this.sendMsgID++;
            }

            msg.Params["_id"] = BitConverter.GetBytes(_id);

            var bytes = msg.ToBytes();
            ArraySegment <byte> buffer = new ArraySegment <byte>(bytes);
            await websocket.SendAsync(buffer, System.Net.WebSockets.WebSocketMessageType.Binary, true, System.Threading.CancellationToken.None);

            return(_id);
        }