Firebase Cloud Messaging(WebPush)令牌到期处理 [英] Firebase Cloud Messaging (WebPush) token expiration handling

查看:203
本文介绍了Firebase Cloud Messaging(WebPush)令牌到期处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Firebase来源,每个令牌的有效期为一周.并且因为messaging().onTokenRefresh

As I found out in Firebase source, every token has an expiration time of one week. And because messaging().onTokenRefresh is not implemented now, I'm assuming that there is no way of sending webpush-notifications to users that haven't been on my website with configured FCM for a week or longer.

还是我的假设不正确,并且此到期仅存在于浏览器端?没有浏览器的调用来重新创建令牌,FCM服务器端的令牌不会过期吗?

Or my assumption is incorrect and this expiration exists only on browser side? And tokens on the server-side of FCM aren't expiring without a call from browser to recreate token?

推荐答案

这不是实际的有效期限,而只是一种更新Firebase服务器上令牌信息的方式.如果令牌仍然有效(并且很可能是有效的),则updateToken方法将返回相同的令牌,并且它将继续工作.

It's not an actual expiration, but just a way to update the token information on Firebase servers. If the token is still valid (and it most likely is), updateToken method will return the same token, and it will keep working.

如果在getToken调用后获得另一个令牌,则可以安全地覆盖服务器中的先前令牌.

If you get a different token after a getToken call, you can safely overwrite the previous token in your server.

这篇关于Firebase Cloud Messaging(WebPush)令牌到期处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆