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


C# Pubnub.detailedHistory方法代码示例

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


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

示例1: ThenUnencryptPublishShouldReturnSuccessCodeAndInfo

        public void ThenUnencryptPublishShouldReturnSuccessCodeAndInfo()
        {
            isUnencryptPublished = false;
            Pubnub pubnub = new Pubnub("demo","demo","","",false);
            string channel = "my/channel";
            string message = messageForUnencryptPublish;

            EnqueueCallback(() => pubnub.publish<string>(channel, message, ReturnSuccessUnencryptPublishCodeCallback));
            EnqueueConditional(() => isCheck);

            EnqueueCallback(() => 
            {
                if (!isUnencryptPublished)
                {
                    Assert.IsTrue(isUnencryptPublished, "Unencrypt Publish Failed");
                }
                else
                {
                    EnqueueCallback(() => pubnub.detailedHistory<string>(channel, -1, unEncryptPublishTimetoken, -1, false, CaptureUnencryptDetailedHistoryCallback));
                    EnqueueConditional(() => isUnencryptCheck);
                    EnqueueCallback(() => Assert.IsTrue(isUnencryptDH, "Unable to match the successful unencrypt Publish"));
                }
            });

            EnqueueTestComplete();
        }
开发者ID:hellogurus,项目名称:pubnub-api,代码行数:26,代码来源:WhenAMessageIsPublished.cs

示例2: DetailedHistoryCountDemo

        /*public static void Main()
        {
            DetailedHistoryCountDemo();
            Console.ReadLine();
        }*/
        internal static void DetailedHistoryCountDemo()
        {
            Pubnub pubnub = new Pubnub(
                        "demo",
                        "demo",
                        "",
                        "",
                        false);

            string channel = "my_channel";

            //Console.WriteLine("Detailed History Count Demo");
            //pubnub.detailedHistory(channel, 100, DisplayDetailedHistory);

            //Console.WriteLine("Detailed History Count and reverse Demo");
            //pubnub.detailedHistory(channel, -1, -1, 100, true, DisplayDetailedHistory);

            //Console.WriteLine("Detailed History with start and end");
            //pubnub.detailedHistory(channel, 13499635513028988, 13499836911845528, 200, true, DisplayDetailedHistory);

            //Console.WriteLine("Detailed History with start");
            //pubnub.detailedHistory(channel, 13499635513028988, -1, 100, true, DisplayDetailedHistory);

            Console.WriteLine("Detailed History with end");
            pubnub.detailedHistory(channel, -1, 13499836911845528, 100, true, DisplayDetailedHistory);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:31,代码来源:DetailedHistory_Example.cs

示例3: DetailedHistory_Decrypted_Example

        public static void DetailedHistory_Decrypted_Example()
        {
            Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    "enigma",
                    false);
            string channel = "testchannel";
            //pubnub.CIPHER_KEY = "enigma";
            string msg = "Test Message";

            deliveryStatus = false;
            pubnub.publish(channel, msg, DisplayReturnMessage);
            while (!deliveryStatus) ;

            deliveryStatus = false;
            pubnub.detailedHistory(channel, 1, DisplayReturnMessage);
            while (!deliveryStatus) ;
            Console.WriteLine("\n*********** DetailedHistory Messages Received*********** ");

            if (objResponse.Equals(null))
            {
              Console.WriteLine("Null response");
            }
            else
            {
                IList<object> fields = objResponse as IList<object>;
                Console.WriteLine("fields[0]: " + fields[0]);
                Console.WriteLine("fields[1]: " + fields[1]);
                //Assert.AreEqual(fields[0], msg);
            }
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:33,代码来源:PubNub-Example2.cs

示例4: ItShouldReturnDetailedHistory

    public void ItShouldReturnDetailedHistory()
    {
     Pubnub pubnub = new Pubnub(
                "demo",
                "demo",
                "",
                "",
                false
     );
     string channel = "hello_world";

     Common cm = new Common();
     cm.deliveryStatus = false;
     cm.objResponse = null;

     //publish a test message. 
     pubnub.publish(channel, "Test message", cm.DisplayReturnMessage);
             
     while (!cm.deliveryStatus)
       ; 

     cm.deliveryStatus = false;
     cm.objResponse = null;
     pubnub.detailedHistory(channel, 1, cm.DisplayReturnMessage);
     while (!cm.deliveryStatus)
       ;

     string strResponse = "";
     if (cm.objResponse.Equals(null))
       {
        Assert.Fail("Null response");
       } else
        {
          IList<object> fields = cm.objResponse as IList<object>;
          foreach (object item in fields)
            {
             strResponse = item.ToString();
             Console.WriteLine(strResponse);

             Assert.IsNotNull(strResponse);
            }             
            if (fields [0] != null)
             {
               var myObjectArray = (from item in fields select item as object).ToArray();
               IList<object> enumerable = myObjectArray [0] as IList<object>;
               if ((enumerable != null) && (enumerable.Count > 0))
                {
                  foreach (object element in enumerable)
                    {
                     Console.WriteLine("Resp:" + element.ToString());
                    }
                }
                else
                {
                    Assert.Fail("No response");
                }
             }
        }
       }
开发者ID:jhey,项目名称:pubnub-api,代码行数:59,代码来源:WhenDetailedHistoryIsRequested.cs

示例5: DetailHistoryCount10ReturnsRecords

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

                    pubnub.detailedHistory<string>(channel, 10, DetailedHistoryCount10Callback);
                    mreMsgCount10.WaitOne(310 * 1000);
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            Assert.IsTrue(msg10Received, "Detailed History Failed");
                            TestComplete();
                        });
                });
        }
开发者ID:hart404,项目名称:pubnub-api,代码行数:17,代码来源:WhenDetailedHistoryIsRequested.cs

示例6: Main


//.........这里部分代码省略.........
            while (!exitFlag)
            {
                string userinput = Console.ReadLine();
                switch (userinput)
                {
                    case "0":
                        exitFlag = true;
                        break;
                    case "1":
                        Console.WriteLine("Running subscribe() (not implementing connectCallback)");
                        pubnub.subscribe<string>(channel, DisplayReturnMessage);
                        //System.Threading.Tasks.Task subtask = System.Threading.Tasks.Task.Factory.StartNew(() => pubnub.subscribe<string>(channel, DisplayReturnMessage));
                        //pubnub.subscribe<object>(channel, DisplayReturnMessage);
                        //pubnub.subscribe(channel, DisplayReturnMessage);
                        break;
                    case "2":
                        Console.WriteLine("Running subscribe() (implementing connectCallback)");
                        pubnub.subscribe<string>(channel, DisplayReturnMessage, DisplayConnectStatusMessage);
                        //System.Threading.Tasks.Task subtask = System.Threading.Tasks.Task.Factory.StartNew(() => pubnub.subscribe<string>(channel, DisplayReturnMessage));
                        //pubnub.subscribe<object>(channel, DisplayReturnMessage);
                        //pubnub.subscribe(channel, DisplayReturnMessage);
                        break;
                    case "3":
                        Console.WriteLine("Running publish()");
                        Console.WriteLine("Enter the message for publish. To exit loop, enter QUIT");
                        string publishMsg = Console.ReadLine();
                        double doubleData;
                        int intData;
                        if (int.TryParse(publishMsg, out intData))
                        {
                            pubnub.publish<string>(channel, intData, DisplayReturnMessage);
                        }
                        else if (double.TryParse(publishMsg, out doubleData))
                        {
                            pubnub.publish<string>(channel, doubleData, DisplayReturnMessage);
                        }
                        else
                        {
                            //check whether any numeric is sent in double quotes
                            if (publishMsg.IndexOf("\"") == 0 && publishMsg.LastIndexOf("\"") == publishMsg.Length - 1)
                            {
                                string strMsg = publishMsg.Substring(1, publishMsg.Length - 2);
                                if (int.TryParse(strMsg, out intData))
                                {
                                    pubnub.publish<string>(channel, strMsg, DisplayReturnMessage);
                                }
                                else if (double.TryParse(strMsg, out doubleData))
                                {
                                    pubnub.publish<string>(channel, strMsg, DisplayReturnMessage);
                                }
                                else
                                {
                                    pubnub.publish<string>(channel, publishMsg, DisplayReturnMessage);
                                }
                            }
                            else
                            {
                                pubnub.publish<string>(channel, publishMsg, DisplayReturnMessage);
                            }
                        }
                        break;
                    case "4":
                        Console.WriteLine("Running presence()");
                        pubnub.presence<string>(channel, DisplayReturnMessage);
                        //System.Threading.Tasks.Task pretask = System.Threading.Tasks.Task.Factory.StartNew(() => pubnub.presence<string>(channel, DisplayReturnMessage));
                        //pubnub.presence<object>(channel, DisplayReturnMessage);
                        break;
                    case "5":
                        Console.WriteLine("Running detailed history()");
                        pubnub.detailedHistory<string>(channel, 100, DisplayReturnMessage);
                        //pubnub.detailedHistory<object>(channel, 100, DisplayReturnMessage);
                        break;
                    case "6":
                        Console.WriteLine("Running Here_Now()");
                        pubnub.here_now<string>(channel, DisplayReturnMessage);
                        //pubnub.here_now<object>(channel, DisplayReturnMessage);
                        break;
                    case "7":
                        Console.WriteLine("Running unsubscribe()");
                        pubnub.unsubscribe<string>(channel, DisplayReturnMessage);
                        //pubnub.unsubscribe<object>(channel, DisplayReturnMessage);
                        break;
                    case "8":
                        Console.WriteLine("Running presence-unsubscribe()");
                        pubnub.presence_unsubscribe<string>(channel, DisplayReturnMessage);
                        break;
                    case "9":
                        Console.WriteLine("Running time()");
                        pubnub.time<string>(DisplayReturnMessage);
                        break;
                    default:
                        Console.WriteLine("INVALID CHOICE.");
                        break;
                }
            }

            Console.WriteLine("\nPress any key to confirm exit.\n\n");
            Console.ReadLine();

        }
开发者ID:sevco777,项目名称:pubnub-api,代码行数:101,代码来源:Pubnub_Example.cs

示例7: TestUnencryptedSecretDetailedHistoryParams

		public static void TestUnencryptedSecretDetailedHistoryParams()
		{
			Pubnub pubnub = new Pubnub(
				"demo",
				"demo",
				"secretkey",
				"",
				false);
			string channel = "hello_world";
			
			//pubnub.CIPHER_KEY = "enigma";
			int total_msg = 10;
			Common cm = new Common();
			long starttime = cm.Timestamp(pubnub);
			cm.deliveryStatus = false;
			cm.objResponse = null;          
			
			for (int i = 0; i < total_msg / 2; i++)
			{
				cm.deliveryStatus = false;
				string msg = i.ToString();
				pubnub.publish(channel, msg, cm.DisplayReturnMessage);
				while (!cm.deliveryStatus) ;
				//long t = Timestamp();
				//inputs.Add(t, msg);
				Console.WriteLine("Message # " + i.ToString() + " published");
			}
			
			long midtime = cm.Timestamp(pubnub);
			for (int i = total_msg / 2; i < total_msg; i++)
			{
				cm.deliveryStatus = false;
				string msg = i.ToString();
				pubnub.publish(channel, msg, cm.DisplayReturnMessage);
				while (!cm.deliveryStatus) ;
				//long t = Timestamp();
				//inputs.Add(t, msg);
				Console.WriteLine("Message # " + i.ToString() + " published");
			}
			
			long endtime = cm.Timestamp(pubnub);
			
			PubnubUnitTest unitTest = new PubnubUnitTest();
			unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
			unitTest.TestCaseName = "TestUnencryptedSecretDetailedHistoryParams1";
			
			pubnub.PubnubUnitTest = unitTest;
			
			cm.deliveryStatus = false;
			cm.objResponse = null;
			Console.WriteLine("DetailedHistory with start & end");
			pubnub.detailedHistory(channel, starttime, midtime, total_msg / 2, true, cm.DisplayReturnMessage);
			while (!cm.deliveryStatus) ;
			
			Console.WriteLine("DetailedHistory with start & reverse = true");
			string strResponse = "";
			if (cm.objResponse.Equals(null))
			{
				Assert.Fail("Null response");
			} 
			else
			{
				IList<object> fields = cm.objResponse as IList<object>;
				int j = 0;
				if (fields [0] != null)
				{
					var myObjectArray = (from item in fields select item as object).ToArray();
					IList<object> enumerable = myObjectArray [0] as IList<object>;
					if ((enumerable != null) && (enumerable.Count > 0))
					{
						foreach (object element in enumerable)
						{
							strResponse = element.ToString();
							Console.WriteLine(String.Format("resp:{0} :: j: {1}", strResponse, j));
							if(j<total_msg/2)
								Assert.True(j.ToString().Equals(strResponse));
							j++;
						}
					}
					else
					{
						Assert.Fail("No response");
					}
				}            
			}  
			
			PubnubUnitTest unitTest2 = new PubnubUnitTest();
			unitTest2.TestClassName = "WhenDetailedHistoryIsRequested";
			unitTest2.TestCaseName = "TestUnencryptedSecretDetailedHistoryParams2";
			
			pubnub.PubnubUnitTest = unitTest2;
			
			cm.deliveryStatus = false;
			cm.objResponse = null;
			pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, true, cm.DisplayReturnMessage);
			while (!cm.deliveryStatus) ;
			
			Console.WriteLine("DetailedHistory with start & reverse = false");
			strResponse = "";
			if (cm.objResponse.Equals(null))
//.........这里部分代码省略.........
开发者ID:stjom,项目名称:pubnub-api,代码行数:101,代码来源:WhenDetailedHistoryIsRequested.cs

示例8: DetailedHistory_Decrypted_Example

		public static void DetailedHistory_Decrypted_Example()
		{
			Pubnub pubnub = new Pubnub(
				"demo",
				"demo",
				"",
				"enigma",
				false);
			string channel = "hello_world";
			//pubnub.CIPHER_KEY = "enigma";
			string msg = "Test Message";
			Common cm = new Common();
			
			
			cm.deliveryStatus = false;
			cm.objResponse = null;
			
			pubnub.publish(channel, msg, cm.DisplayReturnMessage);
			while (!cm.deliveryStatus) ;
			PubnubUnitTest unitTest = new PubnubUnitTest();
			unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
			unitTest.TestCaseName = "DetailedHistory_Decrypted_Example";
			
			pubnub.PubnubUnitTest = unitTest;
			cm.deliveryStatus = false;
			cm.objResponse = null;
			pubnub.detailedHistory(channel, 1, cm.DisplayReturnMessage);
			while (!cm.deliveryStatus) ;
			Console.WriteLine("\n*********** DetailedHistory Messages Received*********** ");
			
			if (cm.objResponse.Equals(null))
			{
				Assert.Fail("Null response");
			} 
			else
			{
				IList<object> fields = cm.objResponse as IList<object>;
				if (fields [0] != null)
				{
					var myObjectArray = (from item in fields select item as object).ToArray();
					
					IList<object> myObjectList = myObjectArray[0] as IList<object>;
					if (fields [0] != null)
					{
						Console.WriteLine("myObjectList[0]: " + myObjectList[0]);
						Assert.True(msg.Equals(myObjectList[0]));
					}
					else
					{
						Assert.Fail("NULL response");
					}
				}
			}  
		}
开发者ID:stjom,项目名称:pubnub-api,代码行数:54,代码来源:WhenDetailedHistoryIsRequested.cs

示例9: DetailedHistory_Example

		public static void DetailedHistory_Example()
		{
			Pubnub pubnub = new Pubnub(
				"demo",
				"demo",
				"",
				"",
				false);
			string channel = "hello_world";
			//pubnub.CIPHER_KEY = "";
			string msg = "Test Message";
			Common cm = new Common();
			cm.deliveryStatus = false;
			cm.objResponse = null;
			
			pubnub.publish(channel, msg, cm.DisplayReturnMessage);
			while (!cm.deliveryStatus) ;
			
			PubnubUnitTest unitTest = new PubnubUnitTest();
			unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
			unitTest.TestCaseName = "DetailHistoryCount10ReturnsRecords";
			
			pubnub.PubnubUnitTest = unitTest;
			
			cm.deliveryStatus = false;
			cm.objResponse = null;
			
			pubnub.detailedHistory(channel, 10, cm.DisplayReturnMessage);
			while (!cm.deliveryStatus) ;
			Console.WriteLine("\n*********** DetailedHistory Messages Received*********** ");
			
			if (cm.objResponse.Equals(null))
			{
				Assert.Fail("Null response");
			} 
			else
			{
				IList<object> fields = cm.objResponse as IList<object>;
				
				if (fields [0] != null)
				{
					var myObjectArray = (from item in fields select item as object).ToArray();
					IList<object> enumerable = myObjectArray [0] as IList<object>;
					if ((enumerable != null) && (enumerable.Count > 0))
					{
						foreach (object element in enumerable)
						{
							string strResponse = element.ToString();
							Console.WriteLine(String.Format("resp:{0}", strResponse));
							Assert.NotNull(strResponse);
						}
					}
					else
					{
						Assert.Fail("No response");
					}
				}
			}  
		}
开发者ID:stjom,项目名称:pubnub-api,代码行数:59,代码来源:WhenDetailedHistoryIsRequested.cs

示例10: DetailedHistoryStartWithReverseTrue

        public void DetailedHistoryStartWithReverseTrue()
        {
            expectedCountAtStartTimeWithReverseTrue = 0;
            msgStartReverseTrue = false;
            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
                    string channel = "my/channel";
                    startTimeWithReverseTrue = Pubnub.translateDateTimeToPubnubUnixNanoSeconds(DateTime.UtcNow);
                    for (int index = 0; index < 10; index++)
                    {
                        pubnub.publish<string>(channel,
                            string.Format("DetailedHistoryStartTimeWithReverseTrue {0} {1}", startTimeWithReverseTrue, index),
                            DetailedHistorySamplePublishCallback);
                        mrePublishStartReverseTrue.WaitOne(5000);
                    }

                    Thread.Sleep(5000);

                    pubnub.detailedHistory<string>(channel, startTimeWithReverseTrue, DetailedHistoryStartWithReverseTrueCallback, true);
                    mreMsgStartReverseTrue.WaitOne(310 * 1000);
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            Assert.IsTrue(msgStartReverseTrue, "Detailed History with Start and Reverse True Failed");
                            TestComplete();
                        });
                });
        }
开发者ID:hart404,项目名称:pubnub-api,代码行数:28,代码来源:WhenDetailedHistoryIsRequested.cs

示例11: TestEncryptedDetailedHistory

       public static void TestEncryptedDetailedHistory()
       {
          Pubnub pubnub = new Pubnub(
                "demo",
                "demo",
                "",
                "enigma",
                false);
          string channel = "testchannel";
          //pubnub.CIPHER_KEY = "enigma";

          int total_msg = 10;
          Common cm = new Common();
          long starttime = cm.Timestamp(pubnub);
          cm.deliveryStatus = false;
          cm.objResponse = null;

          Dictionary<long, string> inputs = new Dictionary<long, string>();
          for (int i = 0; i < total_msg / 2; i++)
          {
             string msg = i.ToString();
             pubnub.publish(channel, msg, cm.DisplayReturnMessage);
             while (!cm.deliveryStatus) ;
             //long t = Timestamp();
             //inputs.Add(t, msg);
             Console.WriteLine("Message # " + i.ToString() + " published");
          }

          long midtime = cm.Timestamp(pubnub);
          for (int i = total_msg / 2; i < total_msg; i++)
          {
             string msg = i.ToString();
             pubnub.publish(channel, msg, cm.DisplayReturnMessage);
             while (!cm.deliveryStatus) ;
             //long t = Timestamp();
             //inputs.Add(t, msg);
             Console.WriteLine("Message # " + i.ToString() + " published");
          }

          long endtime = cm.Timestamp(pubnub);
          while (!cm.deliveryStatus) ;

          
          cm.objResponse = null;
          pubnub.detailedHistory(channel, total_msg, cm.DisplayReturnMessage);
          cm.deliveryStatus = false;
          while (!cm.deliveryStatus) ;
          Console.WriteLine("\n*********** DetailedHistory Messages Received*********** ");
          string strResponse = "";
          if (cm.objResponse.Equals(null))
          {
            Assert.Fail("Null response");
          } 
          else
          {
             IList<object> fields = cm.objResponse as IList<object>;
             int j = 0;
             if (fields [0] != null)
             {
               var myObjectArray = (from item in fields select item as object).ToArray();
               IList<object> enumerable = myObjectArray [0] as IList<object>;
               if ((enumerable != null) && (enumerable.Count > 0))
                {
                  foreach (object element in enumerable)
                    {
                       strResponse = element.ToString();
                       Console.WriteLine(String.Format("resp:{0} :: j: {1}", strResponse, j));
                       if(j<total_msg)
                          Assert.AreEqual(j.ToString(), strResponse);
                       j++;
                    }
                }
                else
                {
                    Assert.Fail("No response");
                }
             }          
          }  
       }
开发者ID:jhey,项目名称:pubnub-api,代码行数:79,代码来源:WhenDetailedHistoryIsRequested.cs

示例12: ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo

        public void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo()
        {
            isEncryptObjectPublished = false;
            Pubnub pubnub = new Pubnub("demo", "demo", "", "enigma", false);
            string channel = "my/channel";
            object message = new SecretCustomClass();
            messageObjectForEncryptPublish = JsonConvert.SerializeObject(message);

            EnqueueCallback(() => pubnub.publish<string>(channel, message, ReturnSuccessEncryptObjectPublishCodeCallback));
            EnqueueConditional(() => isEncryptObjectPubCheck);

            EnqueueCallback(() =>
            {
                if (!isEncryptObjectPublished)
                {
                    Assert.IsTrue(isEncryptObjectPublished, "Encrypt Object Publish Failed");
                }
                else
                {
                   EnqueueCallback(() => pubnub.detailedHistory<string>(channel, -1, encryptObjectPublishTimetoken, -1, false, CaptureEncryptObjectDetailedHistoryCallback));
                   EnqueueConditional(() => isEncryptObjectDHCheck);
                   EnqueueCallback(() => Assert.IsTrue(isEncryptObjectDH, "Unable to match the successful encrypt object Publish"));
                }
            });

            EnqueueTestComplete();
        }
开发者ID:hellogurus,项目名称:pubnub-api,代码行数:27,代码来源:WhenAMessageIsPublished.cs

示例13: ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo

        public void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo()
        {
            ThreadPool.QueueUserWorkItem((s) =>
                {
                    isEncryptObjectPublished = false;
                    Pubnub pubnub = new Pubnub("demo", "demo", "", "enigma", false);
                    string channel = "my/channel";
                    object message = new SecretCustomClass();
                    messageObjectForEncryptPublish = JsonConvert.SerializeObject(message);
                    

                    pubnub.publish<string>(channel, message, ReturnSuccessEncryptObjectPublishCodeCallback);
                    mreEncryptObjectPub.WaitOne(310 * 1000);

                    if (!isEncryptObjectPublished)
                    {
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                       {
                           Assert.IsTrue(isEncryptObjectPublished, "Encrypt Object Publish Failed");
                           TestComplete();
                       });
                    }
                    else
                    {
                        pubnub.detailedHistory<string>(channel, -1, encryptObjectPublishTimetoken, -1, false, CaptureEncryptObjectDetailedHistoryCallback);
                        mreEncryptObjectDH.WaitOne(310 * 1000);
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                       {
                           Assert.IsTrue(isEncryptObjectDH, "Unable to match the successful encrypt object Publish");
                           TestComplete();
                       });
                    }
                });
        }
开发者ID:hart404,项目名称:pubnub-api,代码行数:34,代码来源:WhenAMessageIsPublished.cs

示例14: TestUnencryptedDetailedHistoryParams

        public static void TestUnencryptedDetailedHistoryParams()
        {
            Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    "",
                    false);
            string channel = "testchannel";

            int total_msg = 10;
            long starttime = Timestamp(pubnub);

            for (int i = 0; i < total_msg / 2; i++)
            {
                deliveryStatus = false;
                string msg = i.ToString();
                pubnub.publish(channel, msg, DisplayReturnMessage);
                while (!deliveryStatus) ;
                //long t = Timestamp();
                //inputs.Add(t, msg);
                Console.WriteLine("Message # " + i.ToString() + " published");
            }

            long midtime = Timestamp(pubnub);
            for (int i = total_msg / 2; i < total_msg; i++)
            {
                deliveryStatus = false;
                string msg = i.ToString();
                pubnub.publish(channel, msg, DisplayReturnMessage);
                while (!deliveryStatus) ;
                //long t = Timestamp();
                //inputs.Add(t, msg);
                Console.WriteLine("Message # " + i.ToString() + " published");
            }

            long endtime = Timestamp(pubnub);

            deliveryStatus = false;

            Console.WriteLine("DetailedHistory with start & end");
            pubnub.detailedHistory(channel, starttime, midtime, total_msg / 2, true, DisplayReturnMessage);
            while (!deliveryStatus) ;

            Console.WriteLine("DetailedHistory with start & reverse = true");
            string strResponse = "";
            if (objResponse.Equals(null))
            {
              Console.WriteLine("Null response");
            }
            else
            {
                IList<object> fields = objResponse as IList<object>;
                int j = 0;
                foreach (object item in fields)
                {
                    strResponse = item.ToString();
                    Console.WriteLine(String.Format("resp:{0} :: j: {1}", strResponse, j));
                    if(j<total_msg/2)
                        Console.WriteLine(j.ToString(), strResponse);
                    j++;
                }
            }

            deliveryStatus = false;
            pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, true, DisplayReturnMessage);
            while (!deliveryStatus) ;

            Console.WriteLine("DetailedHistory with start & reverse = false");
            strResponse = "";
            if (objResponse.Equals(null))
            {
              Console.WriteLine("Null response");
            }
            else
            {
                IList<object> fields = objResponse as IList<object>;
                int j = total_msg / 2;
                foreach (object item in fields)
                {
                    strResponse = item.ToString();
                    Console.WriteLine(String.Format("resp:{0} :: j: {1}", strResponse, j));
                    if(j<total_msg)
                        Console.WriteLine(j.ToString(), strResponse);
                    j++;
                }
            }

            deliveryStatus = false;
            pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, false, DisplayReturnMessage);
            while (!deliveryStatus) ;
            Console.WriteLine("\n******* DetailedHistory Messages Received ******* ");
            strResponse = "";
            if (objResponse.Equals(null))
            {
              Console.WriteLine("Null response");
            }
            else
            {
                IList<object> fields = objResponse as IList<object>;
//.........这里部分代码省略.........
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:101,代码来源:PubNub-Example2.cs

示例15: TestEncryptedDetailedHistoryParams

        public static void TestEncryptedDetailedHistoryParams()
        {
            Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    "enigma",
                    false);
            // Context setup for Detailed Histor
            //pubnub.CIPHER_KEY = "enigma";
            int total_msg = 10;
            long starttime = Timestamp(pubnub);

            for (int i = 0; i < total_msg / 2; i++)
            {
                deliveryStatus = false;
                string msg = i.ToString();
                pubnub.publish(channel, msg, DisplayReturnMessage);
                while (!deliveryStatus) ;
                //long t = Timestamp();
                //inputs.Add(t, msg);
                Console.WriteLine("Message # " + i.ToString() + " published");
            }

            long midtime = Timestamp(pubnub);
            for (int i = total_msg / 2; i < total_msg; i++)
            {
                deliveryStatus = false;
                string msg = i.ToString();
                pubnub.publish(channel, msg, DisplayReturnMessage);
                while (!deliveryStatus) ;
                //long t = Timestamp();
                //inputs.Add(t, msg);
                Console.WriteLine("Message # " + i.ToString() + " published");
            }

            long endtime = Timestamp(pubnub);

            deliveryStatus = false;
            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "DetailedHistory")
                {
                    Console.WriteLine("\n*********** DetailedHistory Messages *********** ");
                    /*foreach (object msg_org in (List<object>)((Pubnub)sender).DetailedHistory)
                    {
                        Console.WriteLine(msg_org.ToString());
                    }*/
                    deliveryStatus = true;
                }
            };
            Console.WriteLine("DetailedHistory with start & end");
            pubnub.detailedHistory(channel, starttime, midtime, total_msg / 2, true, DisplayReturnMessage);
            while (!deliveryStatus) ;
            Console.WriteLine("DetailedHistory with start & reverse = true");
            deliveryStatus = false;
            pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, true, DisplayReturnMessage);
            while (!deliveryStatus) ;
            Console.WriteLine("DetailedHistory with start & reverse = false");
            deliveryStatus = false;
            pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, false, DisplayReturnMessage);
            while (!deliveryStatus) ;
            Console.WriteLine("\n******* DetailedHistory Messages Received ******* ");
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:64,代码来源:PubNub-Example2.cs


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