Windows Azure ServiceBus 推送通知 APNS 架构 [英] Windows Azure ServiceBus Push Notifications APNS Architecture

查看:22
本文介绍了Windows Azure ServiceBus 推送通知 APNS 架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个托管在 windows azure 上的应用程序,它将通过 apns 向 iphone 上的用户发送消息.我使用的是服务总线通知中心而不是移动服务,因为我有一个使用 RavenDB 和队列的现有持久性基础架构.

I am building an application hosted on windows azure which will send messages to users on iphones through the apns. I am using a service bus notification hub rather than a mobile service as I have an existing persistence infrastructure using RavenDB and queues.

说这是我的通知服务发送到苹果的方法:

Say this is my notification service's send to apple method:

public async void SendAppleNotificationAsync(INotification notification)
        {            
            var hub = NotificationHubClient.CreateClientFromConnectionString(
                _configService.Get<NotificationConfig>().ConnectionString, 
                _configService.Get<NotificationConfig>().Hub);

            var appleNotification = new AppleNotification(notification.ToJsonString(), new DateTime());

            await hub.SendNotificationAsync(appleNotification);
        }

我无法解决的是如何向特定设备发送通知,因为我的服务器端应用程序中存储了来自 Apple 的用户设备令牌.

What I am unable to work out is how to send a notification to a specific device, given I have the user's device token from apple stored in my server side application.

我希望 api 有这样的方法:

I was hoping the api had a method like this:

var appleNotification = new AppleNotification(deviceToken, notification.ToJsonString(), new DateTime());

但我似乎无法找到任何针对特定设备的参考.

But I don't seem to be able to find any reference to targeting a specific device.

我是否遗漏了图片的基本内容?

Am I missing something fundamental to the picture?

推荐答案

通知中心可用于向用户组或单个用户发送批量通知.它基本上是一个发布/订阅模型.客户端订阅一个主题,服务器向该主题发布通知.客户可能订阅广泛的主题促销"或狭义的主题用户:123456".本文提供了使用通知中心向单个客户端发送消息的示例代码和演练.

Notification Hubs can be used to send out bulk notifications to groups of users, or to single users. It is basically a publish/subscribe model. The client subscribes to a topic and the server publishes notifications to that topic. A client might subscribe to a broad topic "promotions" or a narrow topic "user:123456". This article gives example code and a walkthrough of using Notification Hubs to send a message to a single client.

http://www.windowsazure.com/en-us/documentation/articles/notification-hubs-aspnet-notify-users/

这篇关于Windows Azure ServiceBus 推送通知 APNS 架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆