【发布时间】:2014-09-16 03:22:06
【问题描述】:
我正在为推送和许多其他工作制作 Azure 后台工作者角色。
与 Azure Push Notification Hub example 发送原始 JsonPayload 字符串不同,Azure 移动服务(a.k.a ZUMO)库为推送提供了更简洁方便的功能。
例如this document介绍如何发送GCM推送如下。
GooglePushMessage message = new GooglePushMessage();
message.Data.Add("greeting", "Hello World!");
message.DelayWhileIdle = true;
message.TimeToLiveInSeconds = 60 * 60 * 2;
message.Add("myKey1", "myValue");
await Services.Push.SendAsync(message);
简而言之,我想使用GooglePushMessage : Microsoft.WindowsAzure.Mobile.Service.Notifications.IPushMessage 类来发送推送。它看起来对 iOS 和 WNS 也很有用。
我的问题是,Services 需要初始化,但很难找到应该给出哪些配置。 Azure 门户中自动生成的示例源提供了许多 MS_ 设置,这些设置在 web.config 中可能对我有用,也可能不可用。
Services的基本初始化代码可能如下所示,但如何正确操作呢?
ConfigOptions options = new ConfigOptions();
HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));
ApiServices Services = new ApiServices(config);
【问题讨论】:
标签: c# azure push-notification azure-mobile-services