问题标签 [web-push]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
2177 浏览

html - HTML5 推送通知 - 其他推送方式的示例

在 Google IO 2015 上,有很多关于带有 HTML5 和服务工作者的 Chrome 推送通知的讨论。

现在还为时尚早,而且例子很少。我正在寻找有关如何从 Google Cloud Messaging 以外的平台(例如 Azure 移动服务或 AWS)实现推送的服务器端示例。

0 投票
1 回答
1178 浏览

google-chrome - Chrome 推送通知:无法从子路径订阅

我正在尝试订阅pushManager,我只能在根 ( /) 路径上实现它。如果我导航到任何子路径 ( /mypath),我会收到Unable to subscribe to push. DOMException: Registration failed - no sender id provided.

问题是,为了订阅,它需要从manifest.json我的目录的根目录中读取值public。出于某种原因,它试图manifest.json从相对于当前路径的目录中查找文件。例如,对于/mypath,它将尝试从 获取文件mydomain/mypath/manifest.json,而它应该总是(我相信)尝试从 获取文件mydomain/manifest.json

我怎么解决这个问题?

相关票证的链接(在 Meteor 的推送通知库中):https ://github.com/taromero/meteor-chrome-push-notifications/issues/1 。

0 投票
1 回答
1667 浏览

iframe - 来自 iframe 的 Service Worker,用于 Web 的 Chrome GCM 通知

我想订阅/取消订阅服务人员以通过 iframe 在网络上获取 Chrome GCM 通知。

我有一个工作原型,可以在直接在浏览器上打开它以及从 window.open javascript 弹出时正常工作。

但它在从 iframe 加载时给出了权限被拒绝错误。

这里可能有什么问题,是的,我的来源是 http,而 iframe URL 是 https。为什么 iframe 不能订阅通知。

0 投票
2 回答
1714 浏览

javascript - Push Notifications Chrome (register and wait notifications)

Following this tutorial I am trying to register my chrome browser to the GCM but I can't subscribe the browser:

I am trying to do the same as the following examples without the button. Once you accept the permision request, I want to get the subscription id but it doesn't work:

Here is the project if you want to check the code:

Thank you.

0 投票
6 回答
42716 浏览

google-chrome - Chrome 推送通知:本站已在后台更新

在实现 chrome 推送通知时,我们正在从我们的服务器获取最新的更改。这样做时,服务人员会显示带有消息的额外通知

本站已在后台更新

已经尝试过这里发布的建议 https://disqus.com/home/discussion/html5rocks/push_notifications_on_the_open_web/
但到目前为止找不到任何有用的东西。有什么建议吗?

0 投票
2 回答
2043 浏览

google-chrome - 我们如何实现网络推送通知?

如何使用 googles GCM 服务在浏览器中实现推送通知。实施相同的步骤是什么。

0 投票
1 回答
3026 浏览

javascript - 如何使用单个 Javascript 标记同时安装服务工作者和清单?

我已经为网站构建了一个服务,可以轻松地将推送通知集成到他们的网站中,但当前的 Chrome 实现还要求他们设置清单和服务工作者。

有没有办法只用一行 Javascript 设置服务工作者和清单?

0 投票
1 回答
5032 浏览

google-cloud-messaging - chrome 推送通知中 Service Worker 中的 GCM 注册 ID

我能够发送推送通知,并且在服务人员中我正在进行服务调用,我只是想通过该服务调用发送 GCM 注册 ID。如何在服务工作者中获取注册 ID 或订阅 ID

这是我的代码

0 投票
2 回答
1059 浏览

service-worker - How is the Push API's push service URL set?

The Push API defines a push service as

a system that allows application servers to send push messages to a webapp.

A subscription to the service is created via a call to serviceWorkerRegistration .pushManager.subscribe() without any parameters.

How is the URL for this push service configured? I would have expected .subscribe() to take a URL parameter for the service.

The Push API's sister spec, Generic Event Delivery Using HTTP Push, says:

push service: This resource is used to create push message subscriptions (see Section 3). A URL for the push service is configured into user agents.

But it does not specify how this configuration would take place.

0 投票
1 回答
2381 浏览

google-chrome - Chrome 上的推送通知 - 同一浏览器上是否可以有多个收件人?

设想 -

  1. 我在 Chrome 上登录帐户 A 并启用新消息的推送通知。工作正常。

  2. 我在同一浏览器上注销并登录帐户 B。当我登录账户 B 时,我想要账户 B 的推送通知。

当您从同一浏览器管理多个帐户时,Gmail 会这样做。它仅显示当前登录的电子邮件帐户的推送通知。

要在我的应用程序中执行此操作,我必须在从帐户 A 注销时取消订阅推送通知,并在我登录帐户 B 时再次订阅推送通知。

有没有更好的方法将它与当前会话联系起来?

编辑:我正在考虑为多个用户注册一个客户端(即机器上的 chrome 浏览器),然后发送带有推送通知有效负载的用户 ID,以确定向谁显示消息。