推送订阅在不到24小时内已经取消订阅或过期,使用statusCode 410。
我使用网络推送和fcm端点& vapidDetails一起发送通知。它能正常工作几个小时,我可以发送通知。但是,当我尝试从后端发送通知时,保存了几个小时--fcm-终结点--订阅就用statusCode 410取消订阅或过期了。我正在部署并签入Heroku。
下面的代码是为了在服务器/后端中保存订阅对象。
swReg.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: urlB64ToUint8Array(publicKey),
}).then(subscriptionJSON => {
saveSubscription(subscriptionJSON);
})在服务器中保存上述订阅对象之后,它将在几个小时内过期。
错误如下所示:
{ WebPushError: Received unexpected response code
at IncomingMessage.<anonymous> (/app/node_modules/web-push/src/web-push-lib.js:316:20)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1125:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
name: 'WebPushError',
message: 'Received unexpected response code',
statusCode: 410,
headers:
{ 'content-type': 'text/plain; charset=utf-8',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '1; mode=block',
date: 'Mon, 27 May 2019 10:11:38 GMT',
'content-length': '47',
'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"',
connection: 'close' } 发布于 2019-06-23 05:30:06
ziet服务器存在一个问题。
ziet服务器不再支持写访问,也就是说fs.write不能工作.
因此,我无法将订阅对象保存/写入db-文件。
我部署到Heroku中,现在它正在按预期工作。
https://stackoverflow.com/questions/56368075
复制相似问题