online job

Monday 24 March 2014

Essential Facebook® Development

Essential
Facebook®
Development


Improving Application:
Performance and Workflow
This chapter covers advanced techniques for increasing application performance, using
Facebook’s built-in query language for accessing data, and working with multiple
developers.
Facebook only gives your application about 8 seconds to return content from the canvas
pages and callbacks before it times out. For canvas pages, this results in displaying an
error to the user. For AJAX callbacks, it means that the user’s last action won’t look like it
worked. If your application loads, but is slow, users will become frustrated and stop using
it.This chapter details some methods for improving your application’s performance using
batching and the Facebook Query Language (FQL).
When multiple developers are working on a project in multiple locations, it can be
convenient to create separate applications.We go over how to create a configuration file
and setup script that allow developers to easily use their own settings, while maintaining a
single set of source files.
Batching API Calls
Batching application programming interface (API) calls decreases page load times by reducing
the number of round trips to the Facebook server.We covered this for users of the
Facebook JavaScript Client Library in Chapter 12,“Facebook JavaScript Client Library;”
in this chapter we show how to use the batching API using the PHP client library. Our
example will be setting the profile box FBML content for multiple users. Listing 16.1
shows how to do this both with and without batching.
Listing 16.1 extracts the first ten friends of the logged-in user and then executes the
separateCalls() function to individually call profile_setFBML() for each user ID.This
is the normal way to execute API functions.The batchedCalls() function is then called.
Inside, before calling users_getInfo(), this function calls begin_batch(), which causes
the PHP client library to delay executing subsequent API calls. profile_setFBML() is
called for each user, but notice that the result is returned by reference.This is because the

No comments: