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


C# WebChannelFactory.VerifySubscribe方法代码示例

本文整理汇总了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);
        }
开发者ID:atsushieno,项目名称:bub,代码行数:34,代码来源:Hub.cs


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