我如何在服务人员中使用subscription.getKey()? [英] How can I leverage subscription.getKey() in service workers?
问题描述
我正在使用基于服务人员的Google Chrome推送通知服务为我的网络用户构建推送通知服务。
当前GCM不允许推送消息到包含有效载荷以克服这种差距,我的服务工作人员检测到推送通知事件并从服务器获取消息,但服务人员无法向服务器标识自己以获取正确的消息。
subscription.getKey('p256dh')是完成此任务的最佳方法吗?任何示例或代码都可用?
Firefox dev版本现在支持加密有效负载的推送通知。你可以在这里找到现场示例 https://people.mozilla.org/~ewong2/推通知测试/ 。和源代码此处。如果您想使用Firefox推送通知,请下载并安装 https://www.mozilla.org/ en-US / firefox / developer /
I'm building a push notification service for my web users using Google Chrome Push Notification Service based on Service Workers.
Currently GCM don't allow push messages to contains payloads in order to overcome this gap my service-worker detects the push-notification event and pulls message from server, however the service worker have no means to identify itself to the server in order to fetch the correct message.
Is subscription.getKey('p256dh') the best approach to accomplish this? Any examples or code available?
Firefox dev version now support push notification with encrypted payload. You can find live example here https://people.mozilla.org/~ewong2/push-notification-test/. And source code here . If you want use firefox push notifications download and install https://www.mozilla.org/en-US/firefox/developer/
这篇关于我如何在服务人员中使用subscription.getKey()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!