简体   繁体   English

在PhoneGap上,Facebook PHP SDK优于JS SDK?

[英]Advantages of Facebook PHP SDK over JS SDK on PhoneGap?

I'm implementing Fb JS SDK on PhoneGap to retrieve the user information, to log him in as well as to retrieve his list of friends. 我正在PhoneGap上实现Fb JS SDK,以检索用户信息,登录他以及检索他的朋友列表。

Since a list of friends can be somewhat huge (?) is there any advantage for me to retrieve the facebook friends list on my server rather than on the phone with a (sometimes) slow connection ? 由于朋友列表可能会很大(?),所以我有什么优势可以在服务器上检索Facebook朋友列表,而不是在连接速度较慢的电话上检索Facebook朋友列表? I'm hesitating to implement this solution and would like to get some advice. 我很想实施此解决方案,并希望获得一些建议。

I've found a part of the answer here which is in favor of the JS SDK for the 2 following reasons: 由于以下两个原因,我在这里找到了部分答案它对JS SDK有利:

  • Less load on your server. 减轻服务器负载。
  • Better response time as the request goes straight from the clients browser to Facebook, rather than from their browser => your server => Facebook, and back again. 由于请求从客户端浏览器直接转到Facebook,而不是从客户端浏览器=>您的服务器=> Facebook,然后再返回,因此响应时间更快。

But I'm still not convinced that for my case it still worth doing a call with the JS SDK and then transfer it to the server from the device/smartphone. 但是我仍然不相信对于我来说,仍然值得使用JS SDK进行调用,然后将其从设备/智能手机传输到服务器。

Thanks 谢谢

EDIT: Here is the process flow I'm using with JS: we are in the case the user is not registered 编辑:这是我正在与JS使用的流程:我们是在用户未注册的情况下

The user wants to log in (phone) -> retrieve info from fb servers (fb servers) -> retrieve his id and send it to the servers (phone) -> check if the user is already registered (server) -> ask for more info to facebook like the friends list (phone -> fb server -> phone) -> register the user (server) ->log in and access the app (phone) 用户想要登录(电话)->从fb服务器(fb服务器)检索信息->检索其ID并将其发送到服务器(电话)->检查用户是否已经注册(服务器)->询问将更多信息发送到Facebook,例如好友列表(电话-> fb服务器->电话)->注册用户(服务器)->登录并访问应用程序(电话)

The reason why I'm doing 2 calls to the server is to ask for as few information to fb as possible if the user is already registered. 我对服务器进行2次呼叫的原因是,如果用户已经注册,则要求向fb尽可能少的信息。 Then ask for more if he isn't 然后再问他是否不是

I don't understand why you think there will be a speed increase for the user if you use the PHP SDK or not, but maybe I'm missing something. 我不明白为什么您认为使用或不使用PHP SDK都会为用户带来更快的速度,但是也许我错过了一些东西。 Won't the paths be like this: 路径不会像这样:

JS SDK: User's phone --> Facebook Server --> Users Phone JS SDK: User's phone --> Facebook Server --> Users Phone

PHP SDK: User's phone --> Your server --> Facebook Server -- > Your server --> Users Phone PHP SDK: User's phone --> Your server --> Facebook Server -- > Your server --> Users Phone

Right? 对? Seems like it will be faster to just use the JS SDK and go directly to Facebook. 似乎仅使用JS SDK并直接转到Facebook会更快。

Also, just FYI, this morning a question came in because Facebook was rejecting somebody's cordova/phonegap app. 同样,仅供参考,今天早上出现了一个问题,因为Facebook拒绝了某人的cordova / phonegap应用程序。 It has something to do with not using the native Android or iOS Facebook SDK, which apparently causes the user to log in again even if they are already logged into the Facebook app on their device. 这与不使用本地Android或iOS Facebook SDK有关,这显然会使用户再次登录,即使他们已经在设备上登录了Facebook应用程序也是如此。 I'm not sure why they are rejecting the app because I'm pretty sure the Facebook plugin does indeed use the Facebook Android/iOS SDK - hopefully it is just a mistaken reviewer at FB. 我不确定他们为什么拒绝该应用程序,因为我非常确定Facebook插件确实使用了Facebook Android / iOS SDK-希望它只是FB的一个错误评论者。 Anyway just thought you should be aware if you are developing a FB/cordova app. 无论如何,只是认为您在开发FB / cordova应用程序时应该注意。

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

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