public void UnsubscribeConnection(string deviceId) { lock (_lock) { var subscribedConnection = SubscribedConnections[deviceId]; subscribedConnection.ConnectionState = ConnectionState.LoggedIn; subscribedConnection.SubscriptionType = SubscriptionType.None; SubscribedConnections.Remove(deviceId); } }
public void PromoteToSubscribedConnection(string deviceId, SubscriptionType subscriptionType) { lock (_lock) { var loggedInConnection = LoggedInConnections[deviceId]; loggedInConnection.ConnectionState = loggedInConnection.ConnectionState | ConnectionState.Subscribed; loggedInConnection.SubscriptionType = subscriptionType; loggedInConnection.Heartbeat(); SubscribedConnections.Add(deviceId, loggedInConnection); _pusherRegistry.AddConnection(loggedInConnection); } }
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); } } }