1

我尝试将 webpush 发送到 firefox

curl -i -X PUT https://updates.push.services.mozilla.com/push/gAAAAABW5EzHyop8VZSH2jm9LJ7W8ybH3ISlbZHDGnd4RwW7h2Jb0IGTuSsP2BCoBxl0kJp-kXXL164xNzhxkTEztP1-IqVf9040VOEuy_htb1nnp-24W-RGgWgjtGK1kZYAb1k3xmAS
HTTP/1.1 400 Bad Request
Access-Control-Allow-Headers: content-encoding,encryption,crypto-key,ttl,encryption-key,content-type,authorization
Access-Control-Allow-Methods: POST,PUT
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: location,www-authenticate
Content-Type: application/json
Date: Tue, 15 Mar 2016 13:04:44 GMT
Server: cyclone/1.1
Content-Length: 51
Connection: keep-alive

{"errno": 102, "code": 400, "error": "Bad Request"}

这是否意味着我的数据库中存储了无效的注册 ID,我应该将其删除?

4

1 回答 1

3

端点 URL 似乎无效,通常类似于https://updates.push.services.mozilla.com/push/v1/SOME_LONG_ID(注意您的 URL 不包含的v1 )。

确实,这有效: curl -i -X PUT https://updates.push.services.mozilla.com/push/v1/gAAAAABW5EzHyop8VZSH2jm9LJ7W8ybH3ISlbZHDGnd4RwW7h2Jb0IGTuSsP2BCoBxl0kJp-kXXL164xNzhxkTEztP1-IqVf9040VOEuy_htb1nnp-24W-RGgWgjtGK1kZYAb1k3xmAS

请注意,您可能想要添加TTL标头,否则您的请求可能会失败(您只需要-H "TTL: 60"):https ://blog.mozilla.org/services/2016/02/20/webpushs-new-requirement-ttl-header/ 。

于 2016-03-15T18:46:49.193 回答