简体   繁体   中英

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.

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 ? 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:

  • 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.

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.

Thanks

EDIT: Here is the process flow I'm using with JS: we are in the case the user is not registered

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)

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. 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. Won't the paths be like this:

JS SDK: User's phone --> Facebook 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.

Also, just FYI, this morning a question came in because Facebook was rejecting somebody's cordova/phonegap app. 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. 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. Anyway just thought you should be aware if you are developing a FB/cordova app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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