Exemple #1
0
 /// <summary>
 /// 전체 채팅방에 메세지를 브로드캐스팅 한다.
 /// </summary>
 /// <param name="accountId">계정</param>
 /// <param name="message">메세지</param>
 public static void BroadcastAll(string accountId, string message)
 {
     Parallel.ForEach(ChatRoomMap, pair =>
     {
         cChatRoom chatRoom = pair.Value;
         if (null != chatRoom)
         {
             chatRoom.Broadcast(accountId, message);
         }
     });
 }
Exemple #2
0
        /// <summary>
        /// 채팅방에 메세지를 브로드캐스팅 한다.
        /// </summary>
        /// <param name="chatRoomIndex">채팅방 인덱스</param>
        /// <param name="accountId">계정</param>
        /// <param name="message">메세지</param>
        /// <returns>성공 유무</returns>
        public static bool Broadcast(int chatRoomIndex, string accountId, string message)
        {
            cChatRoom chatRoom = null;

            if (false == ChatRoomMap.TryGetValue(chatRoomIndex, out chatRoom))
            {
                return(false);
            }

            chatRoom.Broadcast(accountId, message);
            return(true);
        }