gpt4 book ai didi

azure - azure通知中心和azure移动服务之间的区别

转载 作者:行者123 更新时间:2023-12-03 10:38:54 24 4
gpt4 key购买 nike

Azure 通知中心和移动服务之间的主要区别是什么

什么时候使用最好。

谢谢

最佳答案

这些服务有完全不同的目的。

移动服务允许您为运行您的应用的(移动)设备提供后端。想象一个通过基于 REST 的 API 公开的数据库。您可以通过编写 JavaScript 代码来对 CRUD 操作使用react(Azure 使用 node.js 来实现此目的)并限制对数据库的访问。这使您可以快速开发新应用程序(或至少是证明)。通过 JavaScript,您可以通过与 Windows 通知服务 (WNS)、Apple 推送通知服务 (APNS) 等通信或访问 Azure 通知中心来发送推送通知,但这不是移动服务提供的 native 功能,它只是与外部服务交谈。

Azure 通知中心允许您使用一个组件管理多个平台(iOS、Android、WP8、Windows 应用商店)上的推送订阅。您不再需要在自己的表中跟踪订阅(就像您需要使用仅基于移动服务的解决方案一样),也不需要关心扩展。想象一下,不同的设备在此中心注册,您就可以向这些设备发送推送消息,而无需知道您正在与哪种设备通信。这只是推送消息的抽象。

澄清:

具有手动订阅处理的伪代码与通知中心。与WNS/APNS/...直接通信的手动方式:

// query your data tables to determine the devices to notify
// note, that you need to manage (insert, delete) all of those entries as well
var subscriptions = ...;

for (var subscription in subscriptions )
{
if (subscription.Type == 0) // WP8
{
// communicate with the Windows Phone push service to push
}
else if (subscription.Type == 1) // iOS
{
// communicate with the Apple Push Notification Service push
}
else if // etc.
}

使用通知中心:

// determine subscriptions to notify by tag, it's just that simple
var tag = 'player:12345';

var hub = azure.createNotificationHubService(/* credentials */);

// you don't need to care about WNS/APNS/..., the hub will do that for you
hub.send(tag, yourMessage, /* callback */);

希望你能看到这张照片。

关于azure - azure通知中心和azure移动服务之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19424695/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com