Example #1
0
 public Task SubscribeToConnection(HubConnectionContext connection)
 {
     return(Task.Run(() =>
     {
         _Connections.TryAdd(connection.ConnectionId, connection);
         RabbitMQLog.Subscribing(_Logger, "SubscribeToConnection:" + connection.ConnectionId);
     }));
 }
Example #2
0
 public Task SubscribeToUser(HubConnectionContext connection)
 {
     return(Task.Run(() =>
     {
         _Users.TryAdd(connection.UserIdentifier, connection);
         RabbitMQLog.Subscribing(_Logger, "SubscribeToUser:" + connection.ConnectionId);
     }));
 }
        public async Task SubscribeToUser(HubConnectionContext connection)
        {
            await _UserLock.WaitAsync();

            try
            {
                HubConnectionStore subscription = this._Users.GetOrAdd(connection.UserIdentifier, _ => new HubConnectionStore());
                subscription.Add(connection);
                RabbitMQLog.Subscribing(_Logger, "SubscribeToUser:" + connection.ConnectionId);
            }
            finally
            {
                _UserLock.Release();
            }
        }