Пример #1
0
        public void Send(string name, string message)
        {
            var timeChat = new TimeChatInfo
            {
                Name = name,
                Message = message
            };

            Clients.All.broadcastMessage(timeChat);
        }
Пример #2
0
        private void InnerTick()
        {
            var clients = GlobalHost.ConnectionManager.GetHubContext<TimeChatHub>().Clients;
            var timeChat = new TimeChatInfo
                {
                    Name = Environment.MachineName,
                    Message = DateTime.Now.TimeOfDay.ToString()
                };

            if (nrTicks%4 == 0)
                timeChat.Message = "*****";

            if (nrTicks%40 == 0)
                timeChat.Message = "clear";

            nrTicks++;

            clients.All.broadcastMessage(timeChat);
        }