当前位置: 首页>>代码示例>>C#>>正文


C# Pubnub.DetailedHistory方法代码示例

本文整理汇总了C#中Pubnub.DetailedHistory方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.DetailedHistory方法的具体用法?C# Pubnub.DetailedHistory怎么用?C# Pubnub.DetailedHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pubnub的用法示例。


在下文中一共展示了Pubnub.DetailedHistory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DetailedHistoryStartWithReverseTrue

        public void DetailedHistoryStartWithReverseTrue()
        {
            expectedCountAtStartTimeWithReverseTrue = 0;
            messageStartReverseTrue = false;
            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
            unitTest.TestCaseName = "DetailedHistoryStartWithReverseTrue";

            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";
            startTimeWithReverseTrue = Pubnub.TranslateDateTimeToPubnubUnixNanoSeconds(new DateTime(2012, 12, 1));
            for (int index = 0; index < 10; index++)
            {
                pubnub.Publish<string>(channel,
                    string.Format("DetailedHistoryStartTimeWithReverseTrue {0}", index),
                    DetailedHistorySamplePublishCallback, DummyErrorCallback);
                mrePublishStartReverseTrue.WaitOne();
            }

            Task.Delay(2000);

            pubnub.DetailedHistory<string>(channel, startTimeWithReverseTrue, DetailedHistoryStartWithReverseTrueCallback, DummyErrorCallback, true);
            Task.Delay(2000);
            mreMessageStartReverseTrue.WaitOne(310 * 1000);
            pubnub.PubnubUnitTest = null;
            pubnub = null;
            Assert.IsTrue(messageStartReverseTrue, "Detailed History with Start and Reverse True Failed");
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:31,代码来源:WhenDetailedHistoryIsRequested.cs

示例2: ItShouldReturnDetailedHistory

		public void ItShouldReturnDetailedHistory()
		{
			Pubnub pubnub = new Pubnub(
				"demo",
				"demo",
				"",
				"",
				false
				);
			string channel = "hello_world";
			string message = "Test message";
			
			Common common = new Common();
			common.DeliveryStatus = false;
			common.Response = null;
			
			//publish a test message. 
			pubnub.Publish(channel, message, common.DisplayReturnMessage);
			
			while (!common.DeliveryStatus); 
			
			pubnub.PubnubUnitTest = common.CreateUnitTestInstance("WhenDetailedHistoryIsRequested" ,"ItShouldReturnDetailedHistory");
			
			common.DeliveryStatus = false;
			common.Response = null;
			pubnub.DetailedHistory(channel, 1, common.DisplayReturnMessage);
			while (!common.DeliveryStatus);
			
			ParseResponse(common.Response, 0, 0, message);
		}
开发者ID:primohit,项目名称:pubnub-api,代码行数:30,代码来源:WhenDetailedHistoryIsRequested.cs

示例3: ItShouldReturnDetailedHistory

        public void ItShouldReturnDetailedHistory ()
        {
            GC.Collect ();
            Pubnub pubnub = new Pubnub (
                          Common.PublishKey,
                          Common.SubscribeKey,
                          "",
                          "",
                          false
                      );
            string channel = "hello_world_de1";
            string message = "Test Message";
      
            Common common = new Common ();
            common.DeliveryStatus = false;
            common.Response = null;

            pubnub.PubnubUnitTest = common.CreateUnitTestInstance ("WhenDetailedHistoryIsRequested", "ItShouldReturnDetailedHistory");
      
            //publish a test message. 
            pubnub.Publish (channel, message, common.DisplayReturnMessage, common.DisplayReturnMessageDummy);
      
            common.WaitForResponse ();

            common.DeliveryStatus = false;
            common.Response = null;
            Thread.Sleep (1000);
            pubnub.DetailedHistory (channel, 1, common.DisplayReturnMessage, common.DisplayReturnMessageDummy);
            common.WaitForResponse ();

            ParseResponse (common.Response, 0, 0, message);
            pubnub.EndPendingRequests ();
        }
开发者ID:seeva92,项目名称:c-sharp,代码行数:33,代码来源:WhenDetailedHistoryIsRequested.cs

示例4: ThenUnencryptPublishShouldReturnSuccessCodeAndInfo

        public void ThenUnencryptPublishShouldReturnSuccessCodeAndInfo()
        {
            isUnencryptPublished = false;
            Pubnub pubnub = new Pubnub("demo","demo","","",false);
            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAMessageIsPublished";
            unitTest.TestCaseName = "ThenUnencryptPublishShouldReturnSuccessCodeAndInfo";
            pubnub.PubnubUnitTest = unitTest;
            string channel = "my/channel";
            string message = messageForUnencryptPublish;

            pubnub.Publish<string>(channel, message, ReturnSuccessUnencryptPublishCodeCallback);
            mreUnencryptedPublish.WaitOne(310*1000);

            if (!isUnencryptPublished)
            {
                Assert.IsTrue(isUnencryptPublished, "Unencrypt Publish Failed");
            }
            else
            {
                pubnub.DetailedHistory<string>(channel, -1, unEncryptPublishTimetoken, -1, false, CaptureUnencryptDetailedHistoryCallback);
                mreUnencryptDetailedHistory.WaitOne(310 * 1000);
                Assert.IsTrue(isUnencryptDetailedHistory, "Unable to match the successful unencrypt Publish");
            }
        }
开发者ID:hellogurus,项目名称:pubnub-api,代码行数:25,代码来源:WhenAMessageIsPublished.cs

示例5: DetailHistoryCount10ReturnsRecords

        public void DetailHistoryCount10ReturnsRecords()
        {
            message10Received = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
            unitTest.TestCaseName = "DetailHistoryCount10ReturnsRecords";

            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";

            pubnub.DetailedHistory<string>(channel, 10, DetailedHistoryCount10Callback, DummyErrorCallback);
            mreMessageCount10.WaitOne(310 * 1000);
            Assert.IsTrue(message10Received, "Detailed History Failed");
        }
开发者ID:Evgeniy20,项目名称:c-sharp,代码行数:18,代码来源:WhenDetailedHistoryIsRequested.cs

示例6: DetailHistoryCount10ReverseTrueReturnsRecords

        public void DetailHistoryCount10ReverseTrueReturnsRecords()
        {
			Debug.Log("Running DetailHistoryCount10ReverseTrueReturnsRecords()");
            message10ReverseTrueReceived = false;

            Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
            unitTest.TestCaseName = "DetailHistoryCount10ReverseTrueReturnsRecords";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";

            pubnub.DetailedHistory<string>(channel, -1, -1, 10, true, DetailedHistoryCount10ReverseTrueCallback, DummyErrorCallback);
            mreMessageCount10ReverseTrue.WaitOne(310 * 1000);
            UUnitAssert.True(message10ReverseTrueReceived, "Detailed History Failed");
        }
开发者ID:kaido42,项目名称:c-sharp,代码行数:18,代码来源:WhenDetailedHistoryIsRequested.cs

示例7: DetailHistoryCount10ReturnsRecords

        public void DetailHistoryCount10ReturnsRecords()
        {
            message10Received = false;

            Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
            unitTest.TestCaseName = "DetailHistoryCount10ReturnsRecords";

            pubnub.PubnubUnitTest = unitTest;

            string channel = "my/channel";

            pubnub.DetailedHistory<string>(channel, 10, DetailedHistoryCount10Callback);
            mreMessageCount10.WaitOne(310 * 1000);
            Assert.IsTrue(message10Received, "Detailed History Failed");
        }
开发者ID:Vlanta,项目名称:c-sharp,代码行数:18,代码来源:WhenDetailedHistoryIsRequested.cs

示例8: DetailHistoryCount10ReturnsRecords

        public void DetailHistoryCount10ReturnsRecords()
        {
            message10Received = false;

            Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
            string channel = "my/channel";

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
            unitTest.TestCaseName = "DetailHistoryCount10ReturnsRecords";
            pubnub.PubnubUnitTest = unitTest;

            EnqueueCallback(() => pubnub.DetailedHistory<string>(channel, 10, DetailedHistoryCount10Callback));
            EnqueueConditional(() => detailedHistoryCount10CallbackInvoked);
            EnqueueCallback(() => Assert.IsTrue(message10Received, "Detailed History Failed"));

            EnqueueTestComplete();
        }
开发者ID:Vlanta,项目名称:c-sharp,代码行数:18,代码来源:WhenDetailedHistoryIsRequested.cs

示例9: DetailedHistoryStartWithReverseTrue

        public void DetailedHistoryStartWithReverseTrue()
        {
            expectedCountAtStartTimeWithReverseTrue = 0;
            messageStartReverseTrue = false;
            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
                    unitTest.TestCaseName = "DetailedHistoryStartWithReverseTrue";
                    pubnub.PubnubUnitTest = unitTest;

                    string channel = "hello_my_channel";
                     if (PubnubCommon.EnableStubTest)
                    {
                        startTimeWithReverseTrue = Pubnub.TranslateDateTimeToPubnubUnixNanoSeconds(new DateTime(2012, 12, 1));
                    }
                    else
                    {
                        startTimeWithReverseTrue = Pubnub.TranslateDateTimeToPubnubUnixNanoSeconds(DateTime.UtcNow);
                    }
                    for (int index = 0; index < 10; index++)
                    {
                        mrePublish = new ManualResetEvent(false);
                        pubnub.Publish<string>(channel,
                            string.Format("DetailedHistoryStartTimeWithReverseTrue {0}", index),
                            DetailedHistorySamplePublishCallback, DummyErrorCallback);
                        mrePublish.WaitOne(60 * 1000);
                    }

                    mreDetailedHistory = new ManualResetEvent(false);
                    pubnub.DetailedHistory<string>(channel, startTimeWithReverseTrue, DetailedHistoryStartWithReverseTrueCallback, DummyErrorCallback, true);
                    mreDetailedHistory.WaitOne(60 * 1000);
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            Assert.IsTrue(messageStartReverseTrue, "Detailed History with Start and Reverse True Failed");
                            pubnub.PubnubUnitTest = null;
                            pubnub = null;
                            TestComplete();
                        });
                });
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:43,代码来源:WhenDetailedHistoryIsRequested.cs

示例10: DetailHistoryCount10ReturnsRecords

        public void DetailHistoryCount10ReturnsRecords()
        {
            message10Received = false;
            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
                    string channel = "hello_my_channel";

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
                    unitTest.TestCaseName = "DetailHistoryCount10ReturnsRecords";
                    pubnub.PubnubUnitTest = unitTest;

                    pubnub.DetailedHistory<string>(channel, 10, DetailedHistoryCount10Callback, DummyErrorCallback);
                    mreMessageCount10.WaitOne(310 * 1000);
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            Assert.IsTrue(message10Received, "Detailed History Failed");
                            TestComplete();
                        });
                });
        }
开发者ID:Evgeniy20,项目名称:c-sharp,代码行数:22,代码来源:WhenDetailedHistoryIsRequested.cs

示例11: DetailedHistoryDecryptedExample

        public void DetailedHistoryDecryptedExample ()
        {
            Pubnub pubnub = new Pubnub (
                          Common.PublishKey,
                          Common.SubscribeKey,
                          "",
                          "enigma",
                          false);
            string channel = "hello_world_de3";

            string message = "Test Message";

            Common common = new Common ();
            common.DeliveryStatus = false;
            common.Response = null;

            pubnub.Publish (channel, message, common.DisplayReturnMessage, common.DisplayReturnMessageDummy);
            common.WaitForResponse ();

            pubnub.PubnubUnitTest = common.CreateUnitTestInstance ("WhenDetailedHistoryIsRequested", "DetailedHistoryDecryptedExample");

            common.DeliveryStatus = false;
            common.Response = null;
            Thread.Sleep (1000);
            pubnub.DetailedHistory (channel, 1, common.DisplayReturnMessage, common.DisplayReturnMessageDummy);

            common.WaitForResponse ();
            Console.WriteLine ("\n*********** DetailedHistory Messages Received*********** ");

            ParseResponse (common.Response, 0, 0, message);
            pubnub.EndPendingRequests ();
        }
开发者ID:seeva92,项目名称:c-sharp,代码行数:32,代码来源:WhenDetailedHistoryIsRequested.cs

示例12: DetailedHistoryStartWithReverseTrue

        public void DetailedHistoryStartWithReverseTrue()
        {
            expectedCountAtStartTimeWithReverseTrue = 0;
            messageStartReverseTrue = false;
            Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
            unitTest.TestCaseName = "DetailedHistoryStartWithReverseTrue";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "my/channel";
            startTimeWithReverseTrue = Pubnub.TranslateDateTimeToPubnubUnixNanoSeconds(DateTime.UtcNow);

            EnqueueCallback(() =>
            {
                for (int index = 0; index < 10; index++)
                {
                    pubnub.Publish<string>(channel,
                                        string.Format("DetailedHistoryStartTimeWithReverseTrue {0}", index),
                                        DetailedHistorySamplePublishCallback);
                    Thread.Sleep(100);
                    EnqueueConditional(() => detailedHistoryPublishCallbackInvoked);
                }
            });

            EnqueueCallback(() => pubnub.DetailedHistory<string>(channel, startTimeWithReverseTrue, DetailedHistoryStartWithReverseTrueCallback, true));
            EnqueueConditional(() => isDetailedHistoryStartReverseTrue);
            EnqueueCallback(() => Assert.IsTrue(messageStartReverseTrue, "Detailed History with Start and Reverse True Failed"));

            EnqueueTestComplete();
        }
开发者ID:Vlanta,项目名称:c-sharp,代码行数:32,代码来源:WhenDetailedHistoryIsRequested.cs

示例13: Main


//.........这里部分代码省略.........
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Enter CHANNEL GROUP name for presence. Use comma to enter multiple channel groups.");
                        Console.WriteLine("To denote a namespaced CHANNEL GROUP, use the colon (:) character with the format namespace:channelgroup.");
                        Console.WriteLine("NOTE: If you want to consider only Presence Channel(s), assuming you already entered, just hit ENTER");
                        channelGroup = Console.ReadLine();

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Presence Channel Group= {0}", channelGroup));
                        Console.ResetColor();
                        Console.WriteLine();

                        if (channel.Length <= 0 && channelGroup.Length <= 0)
                        {
                            Console.WriteLine("To run presence(), atleast provide either channel name or channel group name or both");
                        }
                        else
                        {
                            Console.WriteLine("Running presence()");
                            pubnub.Presence<string>(channel, channelGroup, DisplaySubscribeReturnMessage, DisplaySubscribeConnectStatusMessage, DisplayErrorMessage);
                        }
                        break;
                    case "4":
                        Console.WriteLine("Enter CHANNEL name for Detailed History");
                        channel = Console.ReadLine();

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}",channel));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Running detailed history()");
                        pubnub.DetailedHistory<string>(channel, 100, DisplayReturnMessage, DisplayErrorMessage);
                        break;
                    case "5":
                        bool showUUID = true;
                        bool includeUserState = false;

                        Console.WriteLine("Enter CHANNEL name for HereNow");
                        channel = Console.ReadLine();

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}",channel));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Show UUID List? Y or N? Default is Y. Press N for No Else press ENTER");
                        string userChoiceShowUUID = Console.ReadLine();
                        if (userChoiceShowUUID.ToLower() == "n")
                        {
                            showUUID = false;
                        }
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Show UUID = {0}",showUUID));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Include User State? Y or N? Default is N. Press Y for Yes Else press ENTER");
                        string userChoiceIncludeUserState = Console.ReadLine();
                        if (userChoiceIncludeUserState.ToLower() == "y")
                        {
                            includeUserState = true;
                        }
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Include User State = {0}", includeUserState));
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:67,代码来源:PubnubExample.cs

示例14: ThenDisableJsonEncodeShouldSendSerializedObjectMessage

        public void ThenDisableJsonEncodeShouldSendSerializedObjectMessage()
        {
            ThreadPool.QueueUserWorkItem((s) =>
                {
                    isSerializedObjectMessagePublished = false;
                    Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
                    pubnub.EnableJsonEncodingForPublish = false;

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenAMessageIsPublished";
                    unitTest.TestCaseName = "ThenDisableJsonEncodeShouldSendSerializedObjectMessage";
                    pubnub.PubnubUnitTest = unitTest;

                    string channel = "my/channel";
                    object message = "{\"operation\":\"ReturnData\",\"channel\":\"Mobile1\",\"sequenceNumber\":0,\"data\":[\"ping 1.0.0.1\"]}";
                    serializedObjectMessageForPublish = message.ToString();

                    pubnub.Publish<string>(channel, message, ReturnSuccessSerializedObjectMessageForPublishCallback);
                    mreSerializedObjectMessageForPublish.WaitOne(310 * 1000);

                    if (!isSerializedObjectMessagePublished)
                    {
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                Assert.IsTrue(isSerializedObjectMessagePublished, "Serialized Object Message Publish Failed");
                                TestComplete();
                            });
                    }
                    else
                    {
                        pubnub.DetailedHistory<string>(channel, -1, serializedMessagePublishTimetoken, -1, false, CaptureSerializedMessagePublishDetailedHistoryCallback);
                        mreSerializedMessagePublishDetailedHistory.WaitOne(310 * 1000);
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                Assert.IsTrue(isSerializedObjectMessageDetailedHistory, "Unable to match the successful serialized object message Publish");
                                TestComplete();
                            });
                    }
                });
        }
开发者ID:Vlanta,项目名称:c-sharp,代码行数:40,代码来源:WhenAMessageIsPublished.cs

示例15: TestEncryptedDetailedHistorySSL

        public void TestEncryptedDetailedHistorySSL ()
        {
            Pubnub pubnub = new Pubnub (
                          Common.PublishKey,
                          Common.SubscribeKey,
                          "",
                          "enigma",
                          true);
            string channel = "hello_world_de15";

            int totalMessages = 10;

            Common common = new Common ();
            common.DeliveryStatus = false;
            common.Response = null;

            long starttime = common.Timestamp (pubnub);

            SendMultipleIntMessages (0, totalMessages, channel, pubnub);

            long midtime = common.Timestamp (pubnub);

            SendMultipleIntMessages (totalMessages, totalMessages / 2, channel, pubnub);

            long endtime = common.Timestamp (pubnub);
            common.WaitForResponse ();

            pubnub.PubnubUnitTest = common.CreateUnitTestInstance ("WhenDetailedHistoryIsRequested", "TestEncryptedDetailedHistory");

            common.Response = null;
            common.DeliveryStatus = false;
            Thread.Sleep (1000);
            pubnub.DetailedHistory (channel, totalMessages, common.DisplayReturnMessage, common.DisplayReturnMessageDummy);

            common.WaitForResponse ();
            Console.WriteLine ("\n*********** DetailedHistory Messages Received*********** ");

            ParseResponse (common.Response, 0, totalMessages, "");
            pubnub.EndPendingRequests ();
        }
开发者ID:seeva92,项目名称:c-sharp,代码行数:40,代码来源:WhenDetailedHistoryIsRequested.cs


注:本文中的Pubnub.DetailedHistory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。