Пример #1
0
 public void Add(ChannelEntity channelEntity, bool reset)
 {
     if (!channelEntitiesDictionary.ContainsKey(channelEntity.ChannelID))
     {
         channelEntity.ChannelParams.IsSubscribed = true;
         channelEntitiesDictionary.Add(channelEntity.ChannelID, channelEntity.ChannelParams);
         #if (ENABLE_PUBNUB_LOGGING)
         this.PubNubInstance.PNLog.WriteToLog(string.Format("Add: channelEntities key add {0} {1} {2}", channelEntity.ChannelID.ChannelOrChannelGroupName, channelEntity.ChannelID.IsChannelGroup, channelEntity.ChannelParams.IsSubscribed), PNLoggingMethod.LevelInfo);
         #endif
     }
     else
     {
         channelEntitiesDictionary [channelEntity.ChannelID].IsAwaitingConnectCallback = channelEntity.ChannelParams.IsAwaitingConnectCallback;
         channelEntitiesDictionary [channelEntity.ChannelID].IsSubscribed = true;
         Dictionary <string, object> userState = channelEntitiesDictionary [channelEntity.ChannelID].UserState;
         if (userState == null)
         {
             channelEntitiesDictionary [channelEntity.ChannelID].UserState = channelEntity.ChannelParams.UserState;
         }
         #if (ENABLE_PUBNUB_LOGGING)
         this.PubNubInstance.PNLog.WriteToLog(string.Format("Add: channelEntities key update {0} {1} {2}", channelEntity.ChannelID.ChannelOrChannelGroupName, channelEntity.ChannelID.IsChannelGroup, channelEntity.ChannelParams.IsSubscribed), PNLoggingMethod.LevelInfo);
         #endif
     }
     if (reset)
     {
         ResetChannelsAndChannelGroupsAndBuildState();
     }
 }
Пример #2
0
        string GenerateAndValidateWebRequestId()
        {
            string newId = Guid.NewGuid().ToString();

            if (!currentWebRequests.ContainsKey(newId))
            {
                #if (ENABLE_PUBNUB_LOGGING)
                this.PNLog.WriteToLog(string.Format("newId: {0}", newId), PNLoggingMethod.LevelInfo);
                #endif

                return(newId);
            }
            else
            {
                #if (ENABLE_PUBNUB_LOGGING)
                this.PNLog.WriteToLog(string.Format("newId, Duplicate found: {0}", newId), PNLoggingMethod.LevelInfo);
                #endif

                return(GenerateAndValidateWebRequestId());
            }
        }