public bool IsLoggedIn(string deviceId) { lock (_lock) { return(LoggedInConnections.ContainsKey(deviceId)); } }
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); } }
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); } } }