Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
0
 public EquipmentHub(ILifetimeScope scope) : base(scope)
 {
     _logger   = scope.Resolve <ILogger <EquipmentHub> >();
     _mediator = HubScope.Resolve <IMediator>();
 }
Ejemplo n.º 3
0
 public CoreHub(ILifetimeScope scope) : base(scope)
 {
     _mediator    = HubScope.Resolve <IMediator>();
     _connections = HubScope.Resolve <ICoreHubConnections>();
     _logger      = HubScope.Resolve <ILogger <CoreHub> >();
 }