My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

About

I've had many questions regarding my project Request.Comet, a comet implementation using Mootools and then recently I needed to get real time updates working on a project of my own, however my implementation was thrown together a while ago, when Comet was new and shy to the Internet world. I then decided to recreate my script in a method that would add more stability to a script. From that was born "Realtime Ajax".

How this is different

The issue with Comet is getting it functioning on client side and server side without it being resource intensive. The problem with keeping one active connection open like in my first implementation on Comet are the following: Loss of data when connection closes, memory leaks will easily occur on both sides and cause script failures, cpu will increase as the connection stays awake. To fix this I had to think of a way to send information without losing and data, keep a connection active but not so long that it causes issues, and give both sides enough time between updating to let the computer's cpu cycle properly.

Realtime Ajax works like this. The client requests the server, which will then check for an update, if there is one you output it right away. If there is no update, the server runs a loop for 30 seconds, every few seconds you can look for an update on the server side and if there are some you will output the update, then exit the script, if there where no updates after the 30 seconds you simply say so by exiting with 'nothing'. On the user side, the client opens a connection to the server like so, and after the request is finished we check to see if there is an update or if it was 'nothing'. If there was an update, we process the event, then we start a new request to the server, also telling the server we just handled the last update. If there was an issue, the user will simply request the the last update by not telling the server it handled the last update. The server then upon the new connection will simply delete the update if it was successful from the update-queue, and if it wasn't it resends the same update.

By doing this we prevent data loss, stay away from persistent connections preventing cpu issues.

Powered by Google Project Hosting