protected override async Task OnDisconnected(IRequest request, string connectionId, bool stopCalled) { if (request.User.GetOrganizationId() != null) { await _connectionMapping.GroupRemoveAsync(request.User.GetOrganizationId(), connectionId).AnyContext(); } await _connectionMapping.UserIdRemoveAsync(request.User.GetUserId(), connectionId).AnyContext(); }
protected override async Task OnDisconnected(IRequest request, string connectionId, bool stopCalled) { try { foreach (var organizationId in request.User.GetOrganizationIds()) { await _connectionMapping.GroupRemoveAsync(organizationId, connectionId); } await _connectionMapping.UserIdRemoveAsync(request.User.GetUserId(), connectionId); } catch (Exception ex) { _logger.Error(ex, "OnDisconnected Error: {0}", ex.Message); throw; } }
private async Task OnDisconnected(HttpContext context, WebSocket socket, string connectionId) { _logger.LogTrace("WebSocket disconnected {ConnectionId} ({State})", connectionId, socket?.State); try { foreach (string organizationId in context.User.GetOrganizationIds()) { await _connectionMapping.GroupRemoveAsync(organizationId, connectionId); } await _connectionMapping.UserIdRemoveAsync(context.User.GetUserId(), connectionId); } catch (Exception ex) { _logger.LogError(ex, "OnDisconnected Error: {Message}", ex.Message); throw; } }