public override async Task OnDisconnectedAsync(Exception exception) { var isOffline = await _tracker.UserDisconnected(Context.User.GetUsername(), Context.ConnectionId); if (isOffline) { await Clients.Others.SendAsync("UserIsOffline", Context.User.GetUsername()); } await base.OnDisconnectedAsync(exception); }
public override async Task OnDisconnectedAsync(Exception e) { await _tracker.UserDisconnected(Context.User.GetUsername(), Context.ConnectionId); await Clients.Others.SendAsync("UserIsOffline", Context.User.GetUsername()); var currentUsers = await _tracker.GetOnlineUsers(); await Clients.All.SendAsync("GetOnlineUsers", currentUsers); await base.OnDisconnectedAsync(e); }