简体   繁体   English

在Meteor.js中将deviceId和用户设备的令牌存储在何处(推送通知)

[英]Where to store deviceId and token of user device in Meteor.js (push notifications)

我想问一下在使用meteor.js时将用户令牌,设备ID和操作系统存储在哪里以获取推送通知吗?

As described in Meteor docs, best practice is to extend the Meteor.users collection. 如Meteor文档中所述,最佳实践是扩展Meteor.users集合。

https://guide.meteor.com/accounts.html#custom-user-data https://guide.meteor.com/accounts.html#custom-user-data

It is not adviced to store them in profile ( https://guide.meteor.com/accounts.html#dont-use-profile ) but rather directly to "add a new uniquely-named top-level field on the user document". 建议不要将它们存储在配置文件中( https://guide.meteor.com/accounts.html#dont-use-profile ),而应直接“在用户文档中添加一个新的唯一命名的顶级字段” 。

If new need a hook on the user creation when creating their account or when loggingin you can use onCreateUser ( https://docs.meteor.com/api/accounts-multi.html#AccountsServer-onCreateUser ) or or onLogin https://docs.meteor.com/api/accounts-multi.html#AccountsCommon-onLogin . 如果新用户在创建用户帐户或登录时需要挂钩用户,则可以使用onCreateUser( https://docs.meteor.com/api/accounts-multi.html#AccountsServer-onCreateUser )或onLogin https:// docs.meteor.com/api/accounts-multi.html#AccountsCommon-onLogin

Be then careful how you publish your new data to the user, especeilly if those are private information. 然后要小心如何将新数据发布给用户,特别是如果这些是私人信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM