示例#1
0
 internal void CurrentPubnubInstance(Pubnub instance)
 {
     PubnubInstance = instance;
     if (!MultiChannelSubscribe.ContainsKey(instance.InstanceId))
     {
         MultiChannelSubscribe.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, long>());
     }
     if (!MultiChannelGroupSubscribe.ContainsKey(instance.InstanceId))
     {
         MultiChannelGroupSubscribe.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, long>());
     }
     if (!ChannelRequest.ContainsKey(instance.InstanceId))
     {
         ChannelRequest.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, HttpWebRequest>());
     }
     if (!ChannelInternetStatus.ContainsKey(instance.InstanceId))
     {
         ChannelInternetStatus.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, bool>());
     }
     if (!ChannelGroupInternetStatus.ContainsKey(instance.InstanceId))
     {
         ChannelGroupInternetStatus.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, bool>());
     }
     if (!ChannelLocalUserState.ContainsKey(instance.InstanceId))
     {
         ChannelLocalUserState.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, Dictionary <string, object> >());
     }
     if (!ChannelGroupLocalUserState.ContainsKey(instance.InstanceId))
     {
         ChannelGroupLocalUserState.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, Dictionary <string, object> >());
     }
     if (!ChannelUserState.ContainsKey(instance.InstanceId))
     {
         ChannelUserState.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, Dictionary <string, object> >());
     }
     if (!ChannelGroupUserState.ContainsKey(instance.InstanceId))
     {
         ChannelGroupUserState.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, Dictionary <string, object> >());
     }
     if (!ChannelReconnectTimer.ContainsKey(instance.InstanceId))
     {
         ChannelReconnectTimer.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, Timer>());
     }
     if (!ChannelGroupReconnectTimer.ContainsKey(instance.InstanceId))
     {
         ChannelGroupReconnectTimer.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, Timer>());
     }
     if (!SubscribeDisconnected.ContainsKey(instance.InstanceId))
     {
         SubscribeDisconnected.GetOrAdd(instance.InstanceId, false);
     }
     if (!LastSubscribeTimetoken.ContainsKey(instance.InstanceId))
     {
         LastSubscribeTimetoken.GetOrAdd(instance.InstanceId, 0);
     }
     if (!SubscribeRequestTracker.ContainsKey(instance.InstanceId))
     {
         SubscribeRequestTracker.GetOrAdd(instance.InstanceId, DateTime.Now);
     }
 }
示例#2
0
        internal void CurrentPubnubInstance(Pubnub instance)
        {
            PubnubInstance = instance;

            if (!MultiChannelSubscribe.ContainsKey(instance.InstanceId))
            {
                MultiChannelSubscribe.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, long>());
            }
            if (!MultiChannelGroupSubscribe.ContainsKey(instance.InstanceId))
            {
                MultiChannelGroupSubscribe.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, long>());
            }
            if (!ChannelRequest.ContainsKey(instance.InstanceId))
            {
                ChannelRequest.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, HttpWebRequest>());
            }
            if (!ChannelInternetStatus.ContainsKey(instance.InstanceId))
            {
                ChannelInternetStatus.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, bool>());
            }
            if (!ChannelGroupInternetStatus.ContainsKey(instance.InstanceId))
            {
                ChannelGroupInternetStatus.GetOrAdd(instance.InstanceId, new ConcurrentDictionary <string, bool>());
            }
        }