protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

            requestState.OperationType = PNOperationType.PNWhereNowOperation;

            string channels = "";

            if ((ChannelsToUse != null) && (ChannelsToUse.Count > 0))
            {
                channels = String.Join(",", ChannelsToUse.ToArray());
            }

            string channelGroups = "";

            if ((ChannelGroupsToUse != null) && (ChannelGroupsToUse.Count > 0))
            {
                channelGroups = String.Join(",", ChannelGroupsToUse.ToArray());
            }

            if (string.IsNullOrEmpty(uuid))
            {
                uuid = this.PubNubInstance.PNConfig.UUID;
            }
            Uri request = BuildRequests.BuildSetStateRequest(
                channels,
                channelGroups,
                Helpers.BuildJsonUserState(ChannelEntities),
                uuid,
                this.PubNubInstance,
                this.QueryParams
                );

            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }
Exemple #2
0
        protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

            requestState.OperationType = OperationType;

            string channels = "";

            if ((ChannelsToUse != null) && (ChannelsToUse.Count > 0))
            {
                channels = String.Join(",", ChannelsToUse.ToArray());
            }

            string channelGroups = "";

            if ((ChannelGroupsToUse != null) && (ChannelGroupsToUse.Count > 0))
            {
                channelGroups = String.Join(",", ChannelGroupsToUse.ToArray());
            }
            Uri request = BuildRequests.BuildHereNowRequest(
                channels,
                channelGroups,
                IncludeUUIDsInHereNow,
                IncludeStateInHereNow,
                this.PubNubInstance,
                this.QueryParams
                );

            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }
Exemple #3
0
        protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

            requestState.OperationType = OperationType;

            string channels = "";

            if (ChannelsToUse != null)
            {
                channels = string.Join(",", ChannelsToUse.ToArray());
            }
            string channelGroups = "";

            if (ChannelGroupsToUse != null)
            {
                channelGroups = string.Join(",", ChannelGroupsToUse.ToArray());
            }

            if (string.IsNullOrEmpty(channels) && (string.IsNullOrEmpty(channelGroups)))
            {
                #if (ENABLE_PUBNUB_LOGGING)
                this.PubNubInstance.PNLog.WriteToLog(string.Format("Both ChannelGroupsToLeave and ChannelsToLeave are empty, running unsubscribe all"), PNLoggingMethod.LevelInfo);
                #endif

                channelGroups      = Helpers.GetNamesFromChannelEntities(this.PubNubInstance.SubscriptionInstance.AllChannelGroups, true);
                channels           = Helpers.GetNamesFromChannelEntities(this.PubNubInstance.SubscriptionInstance.AllChannels, false);
                ChannelsToUse      = Helpers.CreateListOfStringFromListOfChannelEntity(this.PubNubInstance.SubscriptionInstance.AllChannels);
                ChannelGroupsToUse = Helpers.CreateListOfStringFromListOfChannelEntity(this.PubNubInstance.SubscriptionInstance.AllChannelGroups);
            }

            List <ChannelEntity> subscribedChannels = this.PubNubInstance.SubscriptionInstance.AllSubscribedChannelsAndChannelGroups;

            List <ChannelEntity> newChannelEntities;
            this.PubNubInstance.SubscriptionInstance.TryRemoveDuplicatesCheckAlreadySubscribedAndGetChannels(
                OperationType,
                ChannelsToUse,
                ChannelGroupsToUse,
                true,
                out
                newChannelEntities
                );

            //Retrieve the current channels already subscribed previously and terminate them
            this.PubNubInstance.SubWorker.AbortPreviousRequest(subscribedChannels);

            if (!this.PubNubInstance.PNConfig.SuppressLeaveEvents)
            {
                Uri request = BuildRequests.BuildLeaveRequest(
                    channels,
                    channelGroups,
                    this.PubNubInstance
                    );
                base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
            }

            RemoveUnsubscribedChannelsAndDeleteUserState(newChannelEntities);


            //Get all the channels
            this.PubNubInstance.SubWorker.ContinueToSubscribeRestOfChannels();
        }