【问题标题】:Using push notifications service along with WCF for windows store application将推送通知服务与 WCF 一起用于 Windows 商店应用程序
【发布时间】:2013-11-02 06:56:20
【问题描述】:
我想构建一个基于 WCF 服务和 Win8 作为表示层的应用程序。我将在应用程序中提供消息传递功能,因此任何用户都必须在磁贴上看到更新(当新消息到达时)。据我了解,我需要以某种方式使用“推送通知服务”机制来使用新到达的消息更新所有客户端的磁贴?应用程序将如何工作?它应该直接调用WCF服务然后WCF服务应该调用推送通知服务,或者首先Win8调用通知服务调用WCF?有人可以澄清一下这些东西是如何相互交流的吗?也许我应该考虑 WCF Duplex 方法?是否可以让 WCF 服务也成为推送通知服务?
【问题讨论】:
标签:
wcf
windows-8
push-notification
windows-store-apps
windows-store
【解决方案1】:
您可以使用
The Windows Push Notification Services (WNS)。您的应用请求通知渠道。然后它将调用 WCF 服务将其发送到该通道。 WCF 服务将向通知通道(这是一个 URI)发送一个 POST 请求以通知应用程序。请求的数据是 XML 格式的(您可以在链接中阅读)。
Windows 推送通知服务 (WNS) 支持第三方
开发人员从他们自己的发送 toast、tile、徽章和原始更新
云服务。这提供了一种机制来提供新的更新到
以一种节能且可靠的方式为您的用户提供服务。
它涉及以下步骤:
- Your app sends a request for a push notification channel to the Notification
Client Platform.
- The Notification Client Platform asks WNS to create a notification channel.
This channel is returned to the calling device in the form of a Uniform
Resource Identifier (URI).
- The notification channel URI is returned by Windows to your app.
- Your app sends the URI to your own cloud service. This callback mechanism is
an interface between your own app and your own service. It is your
responsibility to implement this callback with safe and secure web standards.
- When your cloud service has an update to send, it notifies WNS using the
channel URI. This is done by issuing an HTTP POST request, including the
notification payload, over Secure Sockets Layer (SSL). This step requires
authentication.
- WNS receives the request and routes the notification to the appropriate
device.