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