Ejemplo n.º 1
0
 private void ChooseScopeofMessage(string text, Socket socket)
 {
     if (text.Length >= 9 && text.Substring(0, 9) == "Subscribe")
     {
         RoomType roomType = getRoomType(text[9]);
         SubscribeToRoom(roomType, socket);
     }
     else if (text == "GetRooms")
     {
         Tuple <int, string> socketDetails = GetIpAddress(socket);
         var roomSubscriber = new RoomSubscriber(this.messageHub);
         roomSubscriber.GetSubscribedRooms(socketDetails);
         SendSubscribedRooms(socket);
     }
     else if (text.Length >= 11 && text.Substring(0, 11) == "UnSubscribe")
     {
         RoomType roomType = getRoomType(text[11]);
         UnsubscribeRoom(roomType, socket);
     }
     else if (text.Length > 9 && text.Substring(0, 9) == "Publisher")
     {
         PublisherMessage(text);
     }
     else if (text == "GetInfo")
     {
         SendCorespondingMessages(socket);
     }
 }