SimplePie 1.3.1 is now available. Upgrade now!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » SimplePie Live! » Frequently Asked Questions » Technical Details

Technical Details

Here are some of the technical details that discuss how SimplePie Live! works.

  • SimplePie Live! is a closed-source web application built on a custom MySQL-enabled branch of SimplePie. The MySQL functionality that we're using will be released as part of SimplePie 1.2.
  • Currently, everything runs directly from our Dreamhost web hosting that has everything installed to run SimplePie optimally. (Compatibility Test)
  • Our asynchronous (AJAX/AJAJ) functionality is not based on XMLHTTPRequest but rather on the JSONP concept, which enables this service to bypass cross-domain scripting prevention in the browser, allowing it to run exclusively in the browser. This is the same process that is used by Google in pretty much all of their AJAX-style services.
  • We are using all default configuration settings for SimplePie, with the exception of the config options we allow to be changed via SimplePie Live, we have a 30 minute cache duration, and we have a custom MySQL caching location. We may tweak and modify these settings from time to time to improve performance and handling. This also specifically means:
    • A 10-second timeout for fetching feeds (we may increase this to 30 seconds)
    • A cache time of 30 minutes
  • All output is UTF-8 by default, so it is recommended that you serve your pages as UTF-8.

How does the JSONP-based AJAX system work?

As mentioned before, SimplePie Live doesn't rely on XMLHTTPRequest but rather on JSONP. Here's a walkthrough for how it all comes together.

  1. We set up a global array called _callback because it needs to be accessible to the entire page.
  2. When you initialize the SimplePie() constructor, you pass in a feed URL (or array of feed URLs), and a series of options including a callback handler for successful and failed responses.
  3. A (hopefully) unique GUID is generated based on the timestamp
  4. The onSuccess() and onFailure() callbacks are saved inside the global _callback array (indexed by the GUID), and are then set to NULL inside the SimplePie instance.
  5. A query string is generated from all of the config options and the guid, and a <script> tag is created and added to the page's <head> section.
  6. The server accepts all of this data from the query string, parses it, and uses it to generate the appropriate JSON object.
  7. After constructing the JSON object, it looks at the GUID that was passed in from the browser. Since the onSuccess() callback function is stored inside the _callback array and indexed by the GUID, the server passes the JSON data as a parameter to the _callback function call.
  8. When the browser downloads this <script> file, the _callback function will execute with all of the JSON-formatted feed data passed in.

live/faq/technical_details.txt · Last modified: 2011/03/05 19:56 (external edit)