Ejemplo n.º 1
0
        protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

            requestState.OperationType = base.OperationType;

            string TimetokenToUseString         = "";
            string ChannelsTimetokenToUseString = "";

            if ((ChannelTimetokensToUse != null) && (ChannelTimetokensToUse.Count == 1))
            {
                TimetokenToUseString         = ChannelTimetokensToUse[0].ToString();
                ChannelsTimetokenToUseString = "";
            }
            else if (ChannelTimetokensToUse != null)
            {
                TimetokenToUseString         = "";
                ChannelsTimetokenToUseString = String.Join(",", ChannelTimetokensToUse.Select(p => p.ToString()).ToArray());
            }
            else
            {
                // TODO: Remove in next major version bump
                TimetokenToUseString         = TimetokenToUse;
                ChannelsTimetokenToUseString = "";
            }

            #if (ENABLE_PUBNUB_LOGGING)
            this.PubNubInstance.PNLog.WriteToLog(string.Format("MessageCountsRequestBuilder: \nChannel {0} \nChannelTimetokens: {1} \nTimetokenToUse:{2}", string.Join(",", this.ChannelsToUse.ToArray()), ChannelsTimetokenToUseString, ChannelsTimetokenToUseString), PNLoggingMethod.LevelInfo);
            #endif

            Uri request = BuildRequests.BuildMessageCountsRequest(
                ChannelsToUse.ToArray(),
                ChannelsTimetokenToUseString,
                TimetokenToUseString,
                this.PubNubInstance,
                this.QueryParams
                );
            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }