JavaScriptSearch Tuesday, August 22, 2006; 02:43 AM
A new AJAX script has been added to the collection of tools at www.unwieldy.net . The so-called AJAX IM v.2 ("Asynchronous JavaScript and XML instant messenger") is a
browser-based instant messaging client. It uses the XMLHTTPRequest
object in JavaScript to send and receive commands to and from the
server. No refreshing of the page is ever needed for this "web
application" to work, as everything is updated in real-time via
JavaScript.

|
The IM client works by "pinging" a PHP-enabled server for new messages. The server
in turn queries a database for any messages for the client, and returns
them as JSON. The XMLHTTPRequest object passes this JSON text be parsed
by the rest of the JavaScript. Alternatively, the client sends data to the server, such as a new
message to another user. This data is then processed by the server
("cleaning" the data of anything invalid) and put into the database,
which is later "pinged" by another client. In essence, AJAX IM simulates a "persistent connection" relationship using only the HTTP protocol and periodic requests. The author of the script has made it available for download in the form of a ~130KB archive.
|