Comments (8)
需要订阅时的用户详情,而示例中的 /sendMessage
接口需要手动传入这些参数,代码如下:
from pwa-book-cn.
谢大神回复,但这段代码我有加的,还是不能触发/sendMessage,而且我看了下,/register的参数跟他的是一样的吧?假如我把这index.html的/register请求改成/sendMessage,在页面首次打开的并点击允许接受通知就能显示/sendMessage的推送内容了,但是后面不能再触发任何推送了,是我描述的不清楚吗?
from pwa-book-cn.
订阅时的用户详情,是一定要保存到数据库才能用吗?首次推送的时候不是获取了用户的订阅详情吗?我调了断点,首次发起的请求(不管是/sendMessage还是/register)能进去,后面怎么点击页面都进不去这两个推送了。
from pwa-book-cn.
我迷惑的点是,如何第二次触发这个推送,就比如怎么才能再次触发/sendMessage这个推送服务?
from pwa-book-cn.
需要改造下代码,前端改也行,后端改也行,目的就是要把注册成功后的那几个重要参数保存好,然后让后端发推送通知时可以正常使用这些参数。/register
好用就是因为它已经把这些参数准备好了。
不知道这样说你能明白嘛
from pwa-book-cn.
我先把参数保存下来试一下,谢谢!
所以这个是因为参数信息的缺失造成的?像/register的推送是因为在index.html里发出了这个请求才发起的推送,那是在什么情况下触发了/sendMessage这个推送呢?浏览器自己触发的?过多长时间会触发呢?
from pwa-book-cn.
我看了下,代码里并没有触发 /sendMessage
接口的操作,建议后端保存参数,前端正常发 /sendMessage
请求即可
from pwa-book-cn.
好的,我先试一下,谢谢耐心解答~!
from pwa-book-cn.
Related Issues (20)
- 代码清单 1.2 好像有点问题 HOT 1
- 中文书名征集 HOT 32
- ch01/1.1.md中有一個語法錯誤 HOT 1
- We offer real estate loans and commercial loans,
- 添加到主屏幕如何取消?多个浏览器都添加会怎样? HOT 3
- 4.1 错别字
- 1.2 错别字
- 2.3 错别字
- 5.1 错别字
- 5.1 原书笔误
- 因为墙的原因 web push 在国内好像chrome上无法使用。 HOT 1
- 请问有没有电子版销售? HOT 2
- 希望第一时间能拿到纸质书版本 HOT 6
- 第七章在线版 HOT 3
- 赠书活动开始啦 🎉🎉🎉 HOT 52
- 赠书活动获奖名单 HOT 22
- 提供在线 GitBook
- 第7章发布 HOT 3
- 楼主不考虑侵权问题? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pwa-book-cn.