public async Task UserDisconnectedFromServer(ApplicationUser user, Guid channelId) { var eventData = new UserJoinedEventData { UserId = user.Id, Username = user.UserName }; await SendEventToGroup(channelId, ChatEvent.UserDisconnected, eventData); }
public async Task UserLeftFromChannel(ApplicationUser user, Guid channelId) { var userConnection = await _connectionsStore.GetUserConnection(user.Id); var eventData = new UserJoinedEventData { UserId = user.Id, Username = user.UserName }; await SendEventToGroup(channelId, ChatEvent.UserLeft, eventData); if (userConnection != null) { await _hubContext.Groups.RemoveFromGroupAsync(userConnection, channelId.ToString()); } }