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); }
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(); }
public async Task BroadcastMessage(SignalRMessage message) { await _hubContext.Clients.All.SendAsync("receiveMessage", message); }
public void BroadcastMessage(SignalRMessage message) { Context.Connection.Broadcast(message); }
public BroadcastSignalRMessage(SignalRMessage body) { Body = body; }