예제 #1
0
        public void BroadcastMessage(SignalRMessage message)
        {
            string lastMessage;

            if (_messageHistory.TryGetValue(message.Name, out lastMessage))
            {
                if (message.Action == ModelAction.Updated && message.Body.ToJson() == lastMessage)
                {
                    return;
                }
            }

            _messageHistory[message.Name] = message.Body.ToJson();

            Context.Connection.Broadcast(message);
        }
예제 #2
0
        public override async Task OnConnectedAsync()
        {
            lock (_connections)
            {
                _connections.Add(Context.ConnectionId);
            }

            var message = new SignalRMessage
            {
                Name = "version",
                Body = new
                {
                    Version = BuildInfo.Version.ToString()
                }
            };

            await Clients.All.SendAsync("receiveMessage", message);

            await base.OnConnectedAsync();
        }
예제 #3
0
 public async Task BroadcastMessage(SignalRMessage message)
 {
     await _hubContext.Clients.All.SendAsync("receiveMessage", message);
 }
예제 #4
0
 public void BroadcastMessage(SignalRMessage message)
 {
     Context.Connection.Broadcast(message);
 }
예제 #5
0
 public BroadcastSignalRMessage(SignalRMessage body)
 {
     Body = body;
 }
 public BroadcastSignalRMessage(SignalRMessage body)
 {
     Body = body;
 }
 public void BroadcastMessage(SignalRMessage message)
 {
     Context.Connection.Broadcast(message);
 }