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


C# Pubnub.history方法代码示例

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


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

示例1: Main

        public static void Main()
        {
            Pubnub pubnub = new Pubnub(
            "demo",
            "demo",
            "",
            false
            );
            string channel = "my/channel";
            string message = "Pubnub API Usage Example";

            pubnub.PropertyChanged += new PropertyChangedEventHandler(Pubnub_PropertyChanged);

            Console.WriteLine("UUID -> " + pubnub.generateGUID());

            pubnub.publish(channel, message);

            pubnub.history(channel, 10);

            pubnub.time();

            pubnub.subscribe(channel);

            Console.ReadKey();
        }
开发者ID:inncapsule,项目名称:CSharpUrlEncodingFix,代码行数:25,代码来源:Pubnub_Example.cs

示例2: ThenItShouldReturnHistoryMessages

        public void ThenItShouldReturnHistoryMessages ()
        {
            Pubnub pubnub = new Pubnub (
                "demo",
                "demo",
                "",
                "",
                false
            );
            string channel = "hello_world";
            bool responseStatus = false;
            //publish a test message.
            Common cm = new Common();
            cm.deliveryStatus = false;
            cm.objResponse = null;
            pubnub.publish (channel, "Test message", cm.DisplayReturnMessage);

            List<object> lstHistory = null;

            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
                if (e.PropertyName == "History")
                {
                    lstHistory = ((Pubnub)sender).History;
           
                    responseStatus = true;
                }
            };

            pubnub.history(channel, 1);

            /*while (!responseStatus) ;

            string strResponse = "";
            if (lstHistory.Equals (null)) {
                Assert.Fail("Null response");
            }
            else
            {
                foreach(object lst in lstHistory)
                {
                    strResponse = lst.ToString();
                    Console.WriteLine("resp:" + strResponse);
                    Assert.IsNotEmpty(strResponse);
                }
            }*/
        }
开发者ID:stjom,项目名称:pubnub-api,代码行数:46,代码来源:WhenGetRequestHistoryMessages.cs

示例3: History_Example

 static void History_Example()
 {
     Pubnub pubnub = new Pubnub(
             "demo",
             "demo",
             "",
             false);
     string channel = "hello_world";
     
     pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
     {
         if (e.PropertyName == "History")
         {
             Console.WriteLine("\n*********** History Messages *********** ");
             MessageFeeder(((Pubnub)sender).History);
         }
     };
     pubnub.history(channel, 10);
 }
开发者ID:Vlanta,项目名称:c-sharp,代码行数:19,代码来源:Pubnub_Example.cs

示例4: History_Example

        static void History_Example()
        {
            Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    false);
            string channel = "my/channel";

            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "History")
                {
                    foreach (object history_message in ((Pubnub)sender).History)
                    {
                        Console.WriteLine("History Message: ");
                        Dictionary<string, object> _messageHistory = (Dictionary<string, object>)(history_message);
                        Console.WriteLine(_messageHistory["text"]);
                    }
                }
            };
            pubnub.history(channel, 10);
        }
开发者ID:inncapsule,项目名称:pubnub-api,代码行数:23,代码来源:Pubnub_Example.cs

示例5: TestUnencryptedHistory

        public static void TestUnencryptedHistory()
        {
             Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    "",
                    false);
            string channel = "my_channel";
            Common cm = new Common();
            cm.deliveryStatus = false;
            cm.objResponse = null;

            string message = "Pubnub API Usage Example - Publish";
            //pubnub.CIPHER_KEY = "enigma";

            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "History")
                {
                    Console.WriteLine("\n*********** History Messages *********** ");
                    cm.deliveryStatus = true;
                }
            };
            cm.deliveryStatus = false;
            pubnub.publish(channel, message, cm.DisplayReturnMessage);
            while (!cm.deliveryStatus) ;

            cm.deliveryStatus = false;
            pubnub.history(channel, 1);
            while (!cm.deliveryStatus) ;
            if (pubnub.History[0].Equals (null)) {
                Assert.Fail("Null response");
            }
            else
            {
                Assert.True(message.Equals(pubnub.History[0].ToString()));
            }
        }
开发者ID:stjom,项目名称:pubnub-api,代码行数:39,代码来源:WhenGetRequestHistoryMessages.cs

示例6: TestUnencryptedHistory

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

            deliveryStatus = false;
            string message = "Pubnub API Usage Example - Publish";

            pubnub.publish(channel, message, DisplayReturnMessage);
            while (!deliveryStatus) ;
            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
                if (e.PropertyName == "History")
                {
                    Console.WriteLine("\n*********** History Messages *********** ");
                    deliveryStatus = true;
                }
            };
            pubnub.history(channel, 1);

            deliveryStatus = false;

            while (!deliveryStatus) ;
            Console.WriteLine("\n*********** Publish *********** ");
            if (pubnub.History[0].Equals (null)) {
                Console.WriteLine("Null response");
            }
            else
            {
                Console.WriteLine(pubnub.History[0].ToString());
            }
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:37,代码来源:PubNub-Example2.cs


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