ajax im ("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 XMLHTTPRequest object allows HTTP requests to be sent to the server
and get input back from the server. There are two parts to the
client-server interaction through this object.
The client "pings" the server (a PHP
script) 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.
The client sends data to the server (a PHP
script), 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.
Ajax im ("асинхронный javascript и xml мгновенный мессенджер") -
мгновенный передающий клиент на основе браузера. Он использует объект
XMLHTTPRequest в JavaScript, который посылает и получает команда от
сервера. Всё происходит без обновления страницы, поскольку все
обновляется в реальном времени через JavaScript.
Объект XMLHTTPRequest позволяет делать запросы
HTTP серверу и возвращать их обратно с сервера. Есть две части к
взаимодействию клиент-сервер через этот объект. Клиент "пингует" сервер
(PHP скрипт) на предмет новых сообщений. Сервер в свою очередь делает
запросы в базу данных для любых сообщений для клиента, и возвращает их
как XML. Объект XMLHTTPRequest передает этот документ XML, который
потом разбирается остальной частью JavaScript.