Azure App Service - 向特定用户发送推送通知
Azure App Service - Send push notification to specific users
我正在结合使用 Azure 应用服务 (Node.js) 和通知中心来注册来自 iOS 应用的推送通知。由于标签在具有 Node.js 后端的应用服务中不再可用,我如何才能针对特定用户推送通知。
一旦用户在 iOS 应用程序中通过身份验证(即通过 Facebook),一个 userId 标签将自动添加到注册中。
当我使用移动服务时,我可以使用以下代码将标签添加到通知中心的设备注册中:
-(void)registerDeviceToken:(nonnull NSData *)deviceToken completion:(nullable MSCompletionBlock)completion;
但是新SDK没有提供标签注册方法:
- (void)registerNativeWithDeviceToken:(NSData*)deviceToken tags:(NSSet*)tags completion:(void (^)(NSError* error))completion;
我的问题是 userId 的格式不像 Facebook:123456789(与移动服务一样),而是在注册过程中自动生成一个 GUID - 我无法存储和查询稍后发送通知时。
任何人都可以帮助我如何将 Azure 应用服务与通知中心一起使用并 Node.js 向特定用户发送通知吗?
MSDN 上的 https://social.msdn.microsoft.com/Forums/azure/en-US/ed5327f6-6f0a-4cbc-91d4-74a9885e2131/nodejs-after-i-upgraded-my-ios-app-from-mobile-services-to-app-services-i-cant-register-for?forum=azuremobile 上有一个类似的线程供您参考。
根据答案,我们知道
The default registration code does not allow you to register for tags deliberately
我们可以从How to: Add tags to a device installation to enable push-to-tags in .Net得到提示:
Following the above How to: Define a custom API controller, you will want to set up a custom API on your backend to work with Notification Hubs to add tags to a specific device installation. Make sure you pass along the Installation ID stored on the client local storage and the tags you want to add (optional, since you can also specify tags directly on your backend). The following snippet should be added to your controller to work with Notification Hubs to add a tag to a device Installation ID.
并且在 Node.js 后端,我们可以利用 Azure SDK for Node.js which contains the functions to push notifications, we can see the usage at https://github.com/Azure/azure-sdk-for-node/blob/master/examples/notification-hubs.md。
的源代码库中获取send()
函数的详细参考
我正在结合使用 Azure 应用服务 (Node.js) 和通知中心来注册来自 iOS 应用的推送通知。由于标签在具有 Node.js 后端的应用服务中不再可用,我如何才能针对特定用户推送通知。
一旦用户在 iOS 应用程序中通过身份验证(即通过 Facebook),一个 userId 标签将自动添加到注册中。 当我使用移动服务时,我可以使用以下代码将标签添加到通知中心的设备注册中:
-(void)registerDeviceToken:(nonnull NSData *)deviceToken completion:(nullable MSCompletionBlock)completion;
但是新SDK没有提供标签注册方法:
- (void)registerNativeWithDeviceToken:(NSData*)deviceToken tags:(NSSet*)tags completion:(void (^)(NSError* error))completion;
我的问题是 userId 的格式不像 Facebook:123456789(与移动服务一样),而是在注册过程中自动生成一个 GUID - 我无法存储和查询稍后发送通知时。
任何人都可以帮助我如何将 Azure 应用服务与通知中心一起使用并 Node.js 向特定用户发送通知吗?
MSDN 上的 https://social.msdn.microsoft.com/Forums/azure/en-US/ed5327f6-6f0a-4cbc-91d4-74a9885e2131/nodejs-after-i-upgraded-my-ios-app-from-mobile-services-to-app-services-i-cant-register-for?forum=azuremobile 上有一个类似的线程供您参考。
根据答案,我们知道
The default registration code does not allow you to register for tags deliberately
我们可以从How to: Add tags to a device installation to enable push-to-tags in .Net得到提示:
Following the above How to: Define a custom API controller, you will want to set up a custom API on your backend to work with Notification Hubs to add tags to a specific device installation. Make sure you pass along the Installation ID stored on the client local storage and the tags you want to add (optional, since you can also specify tags directly on your backend). The following snippet should be added to your controller to work with Notification Hubs to add a tag to a device Installation ID.
并且在 Node.js 后端,我们可以利用 Azure SDK for Node.js which contains the functions to push notifications, we can see the usage at https://github.com/Azure/azure-sdk-for-node/blob/master/examples/notification-hubs.md。
的源代码库中获取send()
函数的详细参考