是否有可能将GetStream.io与使用Create React Native App构build的React Native应用程序集成而不popup?

我正在尝试使用getstream.io的客户端function(特别是提要和实时更新),在使用react-native构build的本机应用程序上构buildstream。 当我尝试使用从我的服务器传递的令牌在JavaScript代码中初始化客户端时,出现错误:

[Error: Missing app id, which is needed to subscribe, use var client = stream.connect(key, secret, appId);]

但是,当我添加秘密和appId(为了testing目的,我会非常谨慎的部署像这样),我得到的错误:

[Error: You are publicly sharing your private key. Dont use the private key while in the browser.]

有没有一种方法来获得运行使用世博会的客户端版本(创buildReact本机应用默认),而不从popup的创build反应本机应用程序?

出于安全原因,您不能使用JS客户端生成令牌客户端,因为这需要共享您的API密钥。

要走的路是为您的后端创build特定于饲料的令牌,并将它们发送到您的客户端应用程序。

服务器端(Ruby):

 require 'stream' client = Stream::Client.new('YOUR_API_KEY', 'API_KEY_SECRET') feed = client.feed('user', '1') token = feed.token 

客户端(JS):

 client = stream.connect('YOUR_API_KEY', null, 'SITE_ID'); user1 = client.feed('user', '1', token); 
Interesting Posts