Ajax Capabilities & Limitations

I have no official training or background in using Ajax technology, but do use it quite frequently when building web applications.

So far I have found it most effective when an AJAX call to a web service is triggered by the user. For example, they start typing in a search box and filtered results appear beneath, or perhaps they click “add comment” and that comment is posted asynchronously. This all works well and tidily through one javascript connection object, and never kicks up much of a fuss! However this post is more of a question than a solution.

My question is, what are the best practices to use for making continous timed calls to a web service / database?

I am currently building a web application where real time synchronisation between users is a key feature.

At first I wanted to approach this problem by using a technique whereby the client leaves an open connection to the web service, with the web service hooking this to a thread and delivering updates to the client (which i planned to achieve by sending JSON object code back and fourth). However, I was informed that this approach is not scalable and in-efficient on most web servers so i looked to polling.

The polling system I am now using means that the client will query the web server at (very) regular intervals in order to update the page. However I get problems when im doing a post to the webserver (perhaps posting a comment) and the page is auto polling in the background. I also have the question, how often should I asynchronously query the web server in order to keep efficient? Should I use separate connection objects in javascript to handle posts and queries? (although i dont think multiple http objects is an option in IE7? ).

As I mentioned my reading and study in this area is limited. I appreciate I could find tutorials on line and try and sequentially find information to answer my own questions, but expect that those who have experience can guide me (and other blog readers) on the orthodox way to do things when it comes to asynchronous web technology!

Anyone can appreciate that the technology here is very powerful. Only a few days ago Apple announced mobileMe and me.com which looks incredible, and very fast! A perfect example of the results I am trying to accomplish in my current project.

I have recently graduated with a 1st class degree in MComp Games Software Development at Sheffield Hallam University, focusing primarily on application development in C++, with experience in graphics programming, scripting languages, DVCS/VCS and web technology. In my spare time I enjoy Drumming, Reading and Snowboarding!

Comments are closed.

Post navigation

I have recently graduated with a 1st class degree in MComp Games Software Development at Sheffield Hallam University, focusing primarily on application development in C++, with experience in graphics programming, scripting languages, DVCS/VCS and web technologyRead More