本文整理汇总了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();
}
示例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);
}
}*/
}
示例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);
}
示例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);
}
示例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()));
}
}
示例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());
}
}