本文整理汇总了C#中WebChannelFactory.VerifySubscribe方法的典型用法代码示例。如果您正苦于以下问题:C# WebChannelFactory.VerifySubscribe方法的具体用法?C# WebChannelFactory.VerifySubscribe怎么用?C# WebChannelFactory.VerifySubscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebChannelFactory
的用法示例。
在下文中一共展示了WebChannelFactory.VerifySubscribe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Subscribe
public void Subscribe(SubscriptionRequest request)
{
if (request == null)
throw new ArgumentNullException ("request");
if (request.Topic == null)
throw new ArgumentException ("request topic is null");
if (request.Callback == null)
throw new ArgumentException ("request callback is null");
if (!String.IsNullOrEmpty (request.Topic.Fragment))
throw new ArgumentException ("request topic must not contain fragment");
if (!String.IsNullOrEmpty (request.Callback.Fragment))
throw new ArgumentException ("request callback must not contain fragment");
if (request.Secret != null)
throw new NotSupportedException ("Secure subscription is not supported yet");
VerifyFetchPolicy (request.Topic, request.Callback);
if (request.Verify == "sync") {
var proxy = new WebChannelFactory<ISub> (request.Callback).CreateChannel ();
proxy.VerifySubscribe (new VerifySubscribeRequest () {
Mode = request.Mode,
Topic = request.Topic,
LeaseSeconds = request.LeaseSeconds,
VerifyToken = request.VerifyToken });
}
List<Uri> list;
if (!state.Entries.TryGetValue (request.Topic, out list))
state.Entries [request.Topic] = list = new List<Uri> ();
list.Add (request.Callback);
save_state_handler (state);
}