Example #1
0
 public bool IsLoggedIn(string deviceId)
 {
     lock (_lock)
     {
         return(LoggedInConnections.ContainsKey(deviceId));
     }
 }
Example #2
0
        public void PromoteToLoggedInConnection(IPersistentConnection connection, string deviceId, long numericDeviceId)
        {
            if (deviceId == null)
            {
                throw new ArgumentNullException(nameof(deviceId));
            }

            lock (_lock)
            {
                InitiatedConnections.Remove(connection.ConnectionId);

                connection.DeviceId        = deviceId;
                connection.NumericDeviceId = numericDeviceId;
                connection.ConnectionState = ConnectionState.LoggedIn;
                connection.Heartbeat();
                LoggedInConnections.Add(connection.DeviceId, connection);
            }
        }
Example #3
0
        public void CloseConnection(IPersistentConnection connection)
        {
            lock (_lock)
            {
                connection.ConnectionState  = ConnectionState.None;
                connection.SubscriptionType = SubscriptionType.None;

                if (connection.DeviceId == null)
                {
                    InitiatedConnections.Remove(connection.ConnectionId);
                }
                else
                {
                    LoggedInConnections.Remove(connection.DeviceId);
                    SubscribedConnections.Remove(connection.DeviceId);
                }
            }
        }