Extension:Livelets

The idea of this extension is to allow live articles to be transcluded which update automatically on change in a non-polling, fully event-driven way. It will use the parser-functions syntax to make it very similar in usage to normal templates. It's called a livelet since it's very similar in concept to the re-usable areas of options and information in a web page often referred to as portlets, or applets if the content is of a more applicational style. The difference with livelets is that they are able to accept spontaneous incoming requests, not just to responses to their own requests, which means that livelets are able to stay up to date or be communicated with dynamically without any regular polling being necessary.

Livelets is still being developed and tested on the OrganicDesign wiki, see OrganicDesign:Extension:Livelets for more details. It involves a number of programming languages, but is installed in the usual way of unpacking the files into the MediaWiki extensions directory and including livelets.php from the LocalSettings.php file. It consists of four files:

Installation
To install this extension the following files which should be saved into a directory called Livelets in your extensions directory. Livelets.php should then be included in your LocalSettings.php file as in the following example,
 * livelets.php
 * livelets.js

Livelets uses the Ajax class from the Mootools Javascript framework, which needs to be separately downloaded from mootools.net/download (put a tick in the ajax item near the bottom of the list and then click the download button) and saved in your extensions directory. The $wgLiveletsMoo global configuration variable must then be set to the relative URL of the location you saved the Javascript. Your SimpleForms inclusion code in your LocalSettings.php file should then look something like the following example,
 * You may need to change the filepaths to suit your own set up
 * Don't forget to ensure that the Javascript file is readable by the webserver using the URL you've specified

Using the Javascript Extension
If you have other extensions installed which also use mootools, then you should not set $wgLiveletsMoo. You may leave the responsiblity of loading Mootools to the other extension, or alternatively use Extension:Javascript to add all the script links checking for duplicates. The inclusion code for your LocalSettings.php file would then look like the following example.

Wait Image
You may also like to include a small animation which displays when very large live content is being retrieved so the user knows that something is happening. We use the following "daisy" image on our site, but any image will do. Save it as wait.gif in the livelets directory and ensure that it is accessible by the web server.



Current State & Usage
Currently the livelet only loads once using Ajax after the page content has loaded and is not dynamically kept up to date. It's used in a similar way to transcluding a template as follows:

Uses
The OrganicDesign site uses a livelet in the sidebar to load the main tree which can be very large for some users and would cause the site to be sluggish if it had to load the whole tree for each new page request. Having the large content in a livelet speeds up the site in two ways, firstly the large content only starts loading after the main page is loaded and accessible. And secondly, because the large content is a separate request with its own static URL, it can be cached locally by the browser.

Live Updates Using SWF
The default installation of Livelets uses Ajax technology which is used by many extensions and by the MediaWiki code itself and is considered safe. The problem with ajax however, is that changes cannot propagate automatically from the server to the clients, the clients must poll the server at a regular interval to see if any changes have taken place. Using SWF technology allows a fully asynchronous connection to be established between the server and the clients making the system fully event driven without any regular polling involved. However this method raises some security concerns as outlined by the XSS alert template above.

The SWF functionality is not complete enough for use yet, but will require the following additional files to be installed into the livelet extension directory:
 * livelets.pl
 * livelets.swf - compiled from livelets.as using the Flashlets extension