本文整理汇总了C#中Pubnub.GetChannelsForChannelGroup方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.GetChannelsForChannelGroup方法的具体用法?C# Pubnub.GetChannelsForChannelGroup怎么用?C# Pubnub.GetChannelsForChannelGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub
的用法示例。
在下文中一共展示了Pubnub.GetChannelsForChannelGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThenGetChannelListShouldReturnSuccess
public void ThenGetChannelListShouldReturnSuccess()
{
currentUnitTestCase = "ThenGetChannelListShouldReturnSuccess";
receivedChannelGroupMessage = false;
pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenChannelGroupIsRequested";
unitTest.TestCaseName = "ThenGetChannelListShouldReturnSuccess";
pubnub.PubnubUnitTest = unitTest;
channelGroupManualEvent = new ManualResetEvent(false);
//string channelName = "hello_my_channel";
pubnub.GetChannelsForChannelGroup<string>(channelGroupName, ChannelGroupCRUDCallback, DummyErrorCallback);
channelGroupManualEvent.WaitOne(10 * 1000, false);
pubnub.EndPendingRequests();
pubnub.PubnubUnitTest = null;
pubnub = null;
Assert.True(receivedChannelGroupMessage, "WhenChannelGroupIsRequested -> ThenGetChannelListShouldReturnSuccess failed.");
}
示例2: Main
//.........这里部分代码省略.........
if (removeChannelGroupNamespace.Trim().Length > 0)
{
Console.WriteLine("Do you want to remove the namespace and all its group names and all its channels? Default is No. Enter Y for Yes, Else just hit ENTER key");
string removeExistingNamespace = Console.ReadLine();
if (removeExistingNamespace.ToLower() == "y")
{
pubnub.RemoveChannelGroupNameSpace<string>(removeChannelGroupNamespace, DisplayReturnMessage, DisplayErrorMessage);
break;
}
}
Console.WriteLine("Enter channel group name");
string removeChannelGroupName = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(string.Format("channel group name = {0}", removeChannelGroupName));
Console.ResetColor();
if (removeChannelGroupName.Trim().Length <= 0)
{
Console.WriteLine("Channel group not provided. Try again");
break;
}
Console.WriteLine("Do you want to remove the channel group and all its channels? Default is No. Enter Y for Yes, Else just hit ENTER key");
string removeExistingGroup = Console.ReadLine();
if (removeExistingGroup.ToLower() == "y")
{
pubnub.RemoveChannelGroup<string>(removeChannelGroupNamespace, removeChannelGroupName, DisplayReturnMessage, DisplayErrorMessage);
break;
}
Console.WriteLine("Enter CHANNEL name. Use comma to enter multiple channels.");
channel = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(string.Format("Channel = {0}",channel));
Console.ResetColor();
Console.WriteLine();
pubnub.RemoveChannelsFromChannelGroup<string>(channel.Split(','), removeChannelGroupNamespace, removeChannelGroupName, DisplayReturnMessage, DisplayErrorMessage);
break;
case "40":
Console.WriteLine("Do you want to get all existing namespaces? Default is No. Enter Y for Yes, Else just hit ENTER key");
string getExistingNamespace = Console.ReadLine();
if (getExistingNamespace.ToLower() == "y")
{
pubnub.GetAllChannelGroupNamespaces<string>(DisplayReturnMessage, DisplayErrorMessage);
break;
}
Console.WriteLine("Enter namespace");
string channelGroupNamespace = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(string.Format("namespace = {0}", channelGroupNamespace));
Console.ResetColor();
if (channelGroupNamespace.Trim().Length > 0)
{
Console.WriteLine("Do you want to get all existing channel group names for the provided namespace? Default is No. Enter Y for Yes, Else just hit ENTER key");
string getExistingGroupNames = Console.ReadLine();
if (getExistingGroupNames.ToLower() == "y")
{
pubnub.GetAllChannelGroups<string>(channelGroupNamespace, DisplayReturnMessage, DisplayErrorMessage);
break;
}
}
else
{
Console.WriteLine("Do you want to get all existing channel group names? Default is No. Enter Y for Yes, Else just hit ENTER key");
string getExistingGroupNames = Console.ReadLine();
if (getExistingGroupNames.ToLower() == "y")
{
pubnub.GetAllChannelGroups<string>(DisplayReturnMessage, DisplayErrorMessage);
break;
}
}
Console.WriteLine("Enter channel group name");
string channelGroupName = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(string.Format("channel group name = {0}", channelGroupName));
Console.ResetColor();
pubnub.GetChannelsForChannelGroup<string>(channelGroupNamespace, channelGroupName, DisplayReturnMessage, DisplayErrorMessage);
break;
default:
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("INVALID CHOICE. ENTER 99 FOR EXIT OR QUIT");
Console.ResetColor();
break;
}
if (!exitFlag)
{
userinput = Console.ReadLine();
Int32.TryParse(userinput, out currentUserChoice);
}
}
Console.WriteLine("\nPress any key to exit.\n\n");
Console.ReadLine();
}
示例3: ThenGetChannelListShouldReturnSuccess
public void ThenGetChannelListShouldReturnSuccess()
{
currentUnitTestCase = "ThenGetChannelListShouldReturnSuccess";
receivedChannelGroupMessage = false;
ThreadPool.QueueUserWorkItem((s) =>
{
Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenChannelGroupIsRequested";
unitTest.TestCaseName = "ThenGetChannelListShouldReturnSuccess";
pubnub.PubnubUnitTest = unitTest;
channelGroupManualEvent = new ManualResetEvent(false);
EnqueueCallback(() => pubnub.GetChannelsForChannelGroup<string>(channelGroupName, ChannelGroupCRUDCallback, DummyErrorCallback));
channelGroupManualEvent.WaitOne(310 * 1000);
EnqueueCallback(() => Assert.IsTrue(receivedChannelGroupMessage, "WhenChannelGroupIsRequested -> ThenGetChannelListShouldReturnSuccess failed."));
EnqueueCallback(() =>
{
pubnub.PubnubUnitTest = null;
pubnub = null;
}
);
EnqueueTestComplete();
});
}