public override async Task OnDisconnectedAsync(Exception?exception) { _logger.LogDebug(exception, "Connection {connectionId} disconnected", Context.ConnectionId); var participant = GetContextParticipant(); var connectionId = Context.ConnectionId; var repo = HubScope.Resolve <IJoinedParticipantsRepository>(); await using var @lock = await repo.LockParticipantJoin(participant); if (_connections.TryRemoveParticipant(participant.Id, new ParticipantConnection(participant.ConferenceId, connectionId))) { _logger.LogDebug("Participant connection exists, publish ParticipantLeftNotification"); await _mediator.Publish(new ParticipantLeftNotification(participant, connectionId), @lock.HandleLostToken); } else { _logger.LogDebug("OnDisconnectedAsync() | Connection does not exist, dont publish notification"); } }
public EquipmentHub(ILifetimeScope scope) : base(scope) { _logger = scope.Resolve <ILogger <EquipmentHub> >(); _mediator = HubScope.Resolve <IMediator>(); }
public CoreHub(ILifetimeScope scope) : base(scope) { _mediator = HubScope.Resolve <IMediator>(); _connections = HubScope.Resolve <ICoreHubConnections>(); _logger = HubScope.Resolve <ILogger <CoreHub> >(); }