예제 #1
0
        public void UnsubscribeConnection(string deviceId)
        {
            lock (_lock)
            {
                var subscribedConnection = SubscribedConnections[deviceId];

                subscribedConnection.ConnectionState  = ConnectionState.LoggedIn;
                subscribedConnection.SubscriptionType = SubscriptionType.None;
                SubscribedConnections.Remove(deviceId);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #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);
                }
            }
        }