/// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Message.MessageAccept Deserialize(Stream stream, Message.MessageAccept instance)
        {
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 Varint
                    case 8:
                        instance.SessionId = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
示例#2
0
        private void GameStarted()
        {
            field = new Field();
            field.ClearField();

            Random rnd = new Random();

            if (rnd.Next(1) == 0)
            {
                players[1].info.Side = Side.O;
                var tmp = new Message.Message(MessageType.MatchReadyInfo, Side.X, Turn.Your, players[1].info);
                SendMessage(players[0], tmp);
                players[0].info.Side = Side.X;
                var tmp2 = new Message.Message(MessageType.MatchReadyInfo, Side.O, Turn.Enemy, players[0].info);
                SendMessage(players[1], tmp2);
            }
            else
            {
                players[0].info.Side = Side.O;
                var tmp = new Message.Message(MessageType.MatchReadyInfo, Side.X, Turn.Your, players[0].info);
                SendMessage(players[1], tmp);
                players[1].info.Side = Side.X;
                var tmp2 = new Message.Message(MessageType.MatchReadyInfo, Side.O, Turn.Enemy, players[1].info);
                SendMessage(players[0], tmp2);
            }
            Oplayer = players.FirstOrDefault(p => p.info.Side == Side.O);
            Xplayer = players.FirstOrDefault(p => p.info.Side == Side.X);
        }
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Message.MessageTokenACK Deserialize(Stream stream, Message.MessageTokenACK instance)
        {
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        instance.Token = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 2 Varint
                    case 16:
                        instance.Expire = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 3 Varint
                    case 24:
                        instance.Index = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 4 LengthDelimited
                    case 34:
                        instance.RequestId = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 5 Varint
                    case 40:
                        instance.BlockId = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 6 Varint
                    case 48:
                        instance.ClientId = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 7 Varint
                    case 56:
                        instance.BlockSize = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 8 Varint
                    case 64:
                        instance.Offset = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
示例#4
0
 public void MyChoice(Point coord)
 {
     if (gameSession.PlayerChoice((int)coord.X, (int)coord.Y))
     {
         var tmp = new Message.Message(MessageType.CoordInfo, coord);
         SendMessage(SerializeMessage(tmp));
     }
 }
示例#5
0
 private byte[] SerializeMessage(Message.Message msg)
 {
     using (MemoryStream stream = new MemoryStream())
     {
         BinaryFormatter formatter = new BinaryFormatter();
         formatter.Serialize(stream, msg);
         return(stream.ToArray());
     }
 }
示例#6
0
 public static Message.Message deserializeStream(byte[] buffer)
 {
     BinaryFormatter binaryF = new BinaryFormatter();
     MemoryStream ms = new MemoryStream(buffer, 0, buffer.Length, false);
     Message.Message pag = new Message.Message("", "");
     pag = (Message.Message)binaryF.Deserialize(ms);
     ms.Close();
     return pag;
 }
示例#7
0
 protected override void doPost(HttpServletRequest request, HttpServletResponse response)
 {
     request.setCharacterEncoding("UTF-8");
     Message.Message newMessage = new Message.Message(request.getParameter("title"),
                                                      request.getParameter("handle"),
                                                      request.getParameter("message"));
     newMessage.date = DateTime.Now;
     Message.Message.messageList.Insert(0, newMessage);
     response.sendRedirect("/testbbs/ShowBBS");
 }
示例#8
0
 public void StopSearching()
 {
     try
     {
         Message.Message tmp = new Message.Message(MessageType.SearchInfo, Message.Search.Stop);
         SendMessage(SerializeMessage(tmp));
     }
     catch
     {
         throw;
     }
 }
示例#9
0
 private void SendMyInfo()
 {
     try
     {
         Message.Message tmp = new Message.Message(MessageType.UserInfo, info);
         SendMessage(SerializeMessage(tmp));
     }
     catch
     {
         throw;
     }
 }
示例#10
0
        /// <summary>
        /// 创建消息
        /// </summary>
        /// <param name="msg">消息标识</param>
        /// <param name="sender">发送者</param>
        /// <param name="receivers">接收者列表</param>
        /// <param name="wParam">消息附加参数</param>
        /// <param name="lParam">消息附加参数</param>
        /// <returns></returns>
        public static Message CreateMsg(uint msg, string sender, string[] receivers = null, object wParam = null, object lParam = null)
        {
            Message m = new Message
            {
                Sender = sender,
                Receivers = receivers,
                Msg = msg,
                WParam = wParam,
                LParam = lParam,
                tick = Environment.TickCount
            };

            return m;
        }
        public async void ReciveMessage()
        {
            try
            {
                while (true)
                {
                    byte[] buff = new byte[2024];
                    await stream.ReadAsync(buff, 0, buff.Length);

                    using (var s = new MemoryStream(buff))
                    {
                        BinaryFormatter formatter = new BinaryFormatter();
                        Message.Message tmp       = (Message.Message)formatter.Deserialize(s);
                        if (tmp.MessageType == MessageType.UserInfo)
                        {
                            info = tmp.UserData;
                        }
                        else if (tmp.MessageType == MessageType.SearchInfo)
                        {
                            if (tmp.SearchInfo == Search.Start)
                            {
                                server.AddInQueueAsync(this);
                            }
                            else
                            {
                                server.RemoveFromQueueAsync(this);
                            }
                        }
                        if (liveGame != null)
                        {
                            liveGame.GotMessage(this, tmp, buff);
                        }
                        if (tmp.MessageType == MessageType.Quit)
                        {
                            server.RemoveClientAsync(this);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                client.Close();
            }
        }
 public void SendMessageAsync(Message.Message msg)
 {
     try
     {
         BinaryFormatter formatter = new BinaryFormatter();
         using (var s = new MemoryStream())
         {
             formatter.Serialize(s, msg);
             stream.WriteAsync(s.ToArray(), 0, (int)s.Length);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Message.MessageRegister Deserialize(Stream stream, Message.MessageRegister instance)
        {
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        instance.Id = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 2 Varint
                    case 16:
                        instance.DiskSpace = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 3 Varint
                    case 24:
                        instance.BlockNum = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 4 LengthDelimited
                    case 34:
                        instance.DataAddr = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 5 Varint
                    case 40:
                        instance.DataPort = (int)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
示例#14
0
 public void GotMessage(GameClient player, Message.Message msg, byte[] message)
 {
     Task.Run(() =>
     {
         if (msg.MessageType == MessageType.CoordInfo)
         {
             field.SetCell((int)msg.Coord.X, (int)msg.Coord.Y, player.info.Side);
             GameStatus();
             SendMessage(player, new Message.Message(MessageType.TurnInfo, Turn.Enemy));
             var tmp = players.FirstOrDefault(p => p.info.Id != player.info.Id);
             SendMessage(tmp, message);
             SendMessage(tmp, new Message.Message(MessageType.TurnInfo, Turn.Your));
         }
         if (msg.MessageType == MessageType.Quit)
         {
             UserLeft(player);
         }
     });
 }
示例#15
0
 private void ProceedMessage(Message.Message tmp)
 {
     if (tmp.MessageType == MessageType.MatchReadyInfo)
     {
         info.Side = tmp.Side;
         gameSession.StartGame(info, tmp.UserData, tmp.TurnInfo);
     }
     if (tmp.MessageType == MessageType.TurnInfo)
     {
         gameSession.Turn = tmp.TurnInfo;
     }
     if (tmp.MessageType == MessageType.CoordInfo)
     {
         gameSession.PlayerChoice((int)tmp.Coord.X, (int)tmp.Coord.Y);
     }
     if (tmp.MessageType == MessageType.ResultInfo)
     {
         gameSession.MatchResult = tmp.MatchResult;
     }
 }
示例#16
0
 private void SendMessage(GameClient player, Message.Message message)
 {
     player.SendMessageAsync(message);
 }
示例#17
0
        public void ReceiveAsync(Message msg)
        {
            if (msg == null) return;

            lock (MsgList.SyncRoot)
            {
                MsgList.Enqueue(msg);

                if (Handling)
                {
                    return;
                }

                Handling = true;
            }

            ThreadPool.QueueUserWorkItem(new WaitCallback(MsgHandle), this);
        }
        /// <summary>Read the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Message.MessagePutAccept DeserializeLength(Stream stream, int length, Message.MessagePutAccept instance)
        {
            long limit = stream.Position + length;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 Varint
                    case 8:
                        instance.Offset = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 2 Varint
                    case 16:
                        instance.Size = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 3 LengthDelimited
                    case 26:
                        instance.Token = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
 /// <summary>Helper: put the buffer into a MemoryStream before deserializing</summary>
 public static Message.MessageRequestGetToken Deserialize(byte[] buffer, Message.MessageRequestGetToken instance)
 {
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
        /// <summary>Read the VarInt length prefix and the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Message.MessageRequestGet DeserializeLengthDelimited(Stream stream, Message.MessageRequestGet instance)
        {
            long limit = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt32(stream);
            limit += stream.Position;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        instance.Path = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 2 LengthDelimited
                    case 18:
                        instance.RequestId = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
示例#21
0
 /// <summary>
 /// Seralize messages into string
 /// </summary>
 /// <returns>Serialized message</returns>
 public string serializeMessageToString(Message m)
 {
     return Convert.ToBase64String(this.toArray());
 }
示例#22
0
        public object ReceiveSync(Message msg)
        {
            if (msg != null)
            {
                if(MsgHandlers.ContainsKey(msg.Msg))
                    return MsgHandlers[msg.Msg](msg);

                if (MsgMethodInfos.ContainsKey(msg.Msg))
                    return MsgMethodInfos[msg.Msg].Invoke(new object[] { msg });
            }

            return null;
        }
示例#23
0
 //[MsgHandler(MsgType.Dispose, false, "释放消息")]
 protected virtual object Dispose(Message msg)
 {
     MsgMonitor.RemoveReceiver(ID);
     return null;
 }
示例#24
0
 public static byte[] serialize(Message msg)
 {
     IFormatter formatter = new BinaryFormatter();
     Stream stream = new MemoryStream();
     formatter.Serialize(stream, msg);
     byte[] buffer = ((MemoryStream)stream).ToArray();
     return buffer;
 }
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Message.MessageToken Deserialize(Stream stream, Message.MessageToken instance)
        {
            if (instance.Token == null)
                instance.Token = new List<string>();
            if (instance.Expire == null)
                instance.Expire = new List<long>();
            if (instance.Address == null)
                instance.Address = new List<string>();
            if (instance.Port == null)
                instance.Port = new List<int>();
            if (instance.BlockId == null)
                instance.BlockId = new List<long>();
            if (instance.Index == null)
                instance.Index = new List<long>();
            if (instance.Size == null)
                instance.Size = new List<long>();
            if (instance.Offset == null)
                instance.Offset = new List<long>();
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        // repeated
                        instance.Token.Add(global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream));
                        continue;
                    // Field 2 Varint
                    case 16:
                        // repeated
                        instance.Expire.Add((long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream));
                        continue;
                    // Field 3 LengthDelimited
                    case 26:
                        // repeated
                        instance.Address.Add(global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream));
                        continue;
                    // Field 4 Varint
                    case 32:
                        // repeated
                        instance.Port.Add((int)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream));
                        continue;
                    // Field 5 Varint
                    case 40:
                        // repeated
                        instance.BlockId.Add((long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream));
                        continue;
                    // Field 6 Varint
                    case 48:
                        // repeated
                        instance.Index.Add((long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream));
                        continue;
                    // Field 7 Varint
                    case 56:
                        // repeated
                        instance.Size.Add((long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream));
                        continue;
                    // Field 8 Varint
                    case 64:
                        // repeated
                        instance.Offset.Add((long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream));
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
 /// <summary>Helper: put the buffer into a MemoryStream before deserializing</summary>
 public static Message.MessageAlive Deserialize(byte[] buffer, Message.MessageAlive instance)
 {
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
        /// <summary>Read the VarInt length prefix and the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Message.MessageAlive DeserializeLengthDelimited(Stream stream, Message.MessageAlive instance)
        {
            long limit = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt32(stream);
            limit += stream.Position;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 Varint
                    case 8:
                        instance.SessionId = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 2 Varint
                    case 16:
                        instance.LocalTime = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 3 Varint
                    case 24:
                        instance.DiskSpace = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 4 Varint
                    case 32:
                        instance.BlockNum = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 5 Varint
                    case 40:
                        instance.TokenNum = (long)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
示例#28
0
 public static Message genRoomNotifi(string toNoti, MessageTypeEnum type)
 {
     Message msg = new Message();
     msg.messageType = type;
     msg.text = toNoti;
     msg.time = System.DateTime.Now.ToString();
     return msg;
 }
示例#29
0
        /// <summary>
        /// 同步发送消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns>所有接收者对应的返回值列表</returns>
        public static Dictionary<string, object> SendMsg(Message msg)
        {
            Dictionary<string, object> rlt = new Dictionary<string, object>();

            if (msgReceiverList.ContainsKey(msg.Msg))
            {
                foreach (IMsgReceiver receiver in msgReceiverList[msg.Msg])
                {
                    object obj = receiver.ReceiveSync(msg);
                    if (obj != null) rlt.Add(receiver.ID, obj);
                }
            }

            if (msg.Receivers != null && msg.Receivers.Length > 0)
            {
                foreach (string id in msg.Receivers)
                {
                    if (receiverList.ContainsKey(id))
                    {
                        object obj = receiverList[id].ReceiveSync(msg);
                        if (obj != null) rlt.Add(id, obj);
                    }
                }
            }

            return rlt;
        }
示例#30
0
        public void SendQuitMessage()
        {
            var tmp = new Message.Message(MessageType.Quit);

            SendMessage(SerializeMessage(tmp));
        }
示例#31
0
        /// <summary>
        /// 异步发送消息
        /// </summary>
        /// <param name="msg"></param>
        public static void PostMsg(Message msg)
        {
            if (msgReceiverList.ContainsKey(msg.Msg))
            {
                foreach (IMsgReceiver receiver in msgReceiverList[msg.Msg])
                {
                    receiver.ReceiveAsync(msg);
                }
            }

            if (msg.Receivers != null && msg.Receivers.Length > 0)
            {
                foreach (string id in msg.Receivers)
                {
                    if (receiverList.ContainsKey(id))
                    {
                        receiverList[id].ReceiveAsync(msg);
                    }
                }
            }
        }
	    public void listTopics()
	    {
            Message.Message msg = new Message.Message("getTopics", "");
            sendMessage(msg);
	     }