gpt4 book ai didi

meteor - DDP.connect 和 Meteor.users

转载 作者:行者123 更新时间:2023-12-03 23:15:43 24 4
gpt4 key购买 nike

我正在尝试将移动应用程序与桌面应用程序部分分开,并认为我尝试将 DDP.connect 作为移动应用程序与桌面应用程序共享数据的一种方式。

我的第一个障碍是关于 Meteor 的内部收藏和出版物。

我应该如何对用户进行身份验证?我知道我可以调用 login 方法对用户进行身份验证,但这仍然没有为我提供我习惯使用 Meteor.users 的所有其他不错的 react 特性

这应该有效吗,如果可以,模式是什么。

谢谢

最佳答案

这是与远程服务器完全集成的内容(代码刷新除外,它会忘记用户 session )

if (Meteor.isClient) {
Meteor.connection = DDP.connect('http://remote.site.com');
Accounts.connection = Meteor.connection;
Meteor.users = new Meteor.Collection('users');
SomeCollection = new Meteor.Collection('remote_collection');
Meteor.connection.subscribe('users');
Meteor.connection.subscribe('remote_collection');
// rest if the code just as always
}

这样您就可以直接使用登录(通过帐户库、帐户传递等),而无需调用登录方法。只需添加 accounts-ui 并包含 {{>loginButtons}} 即可

关于meteor - DDP.connect 和 Meteor.users,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28484319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com