Exemplo n.º 1
0
        /// <summary>
        /// Push to a specific user
        /// </summary>
        /// <param name="who"></param>
        /// <param name="message"></param>
        public static void PushToUser(string who, AnnouncementViewModel message, TMDTHub hub)
        {
            IHubConnectionContext <dynamic> clients = GetClients(hub);

            foreach (var connectionId in _connections.GetConnections(who))
            {
                clients.Client(connectionId).addChatMessage(message);
            }
        }
Exemplo n.º 2
0
 private static IHubConnectionContext <dynamic> GetClients(TMDTHub tmdtHub)
 {
     if (tmdtHub == null)
     {
         return(GlobalHost.ConnectionManager.GetHubContext <TMDTHub>().Clients);
     }
     else
     {
         return(tmdtHub.Clients);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Push to list users
        /// </summary>
        /// <param name="who"></param>
        /// <param name="message"></param>
        public static void PushToUsers(string[] whos, AnnouncementViewModel message, TMDTHub hub)
        {
            IHubConnectionContext <dynamic> clients = GetClients(hub);

            for (int i = 0; i < whos.Length; i++)
            {
                var who = whos[i];
                foreach (var connectionId in _connections.GetConnections(who))
                {
                    clients.Client(connectionId).addChatMessage(message);
                }
            }
        }
Exemplo n.º 4
0
        public static void PushToAllUsers(AnnouncementViewModel message, TMDTHub hub)
        {
            IHubConnectionContext <dynamic> clients = GetClients(hub);

            clients.All.addAnnouncement(message);
        }