Software Development

Why long-polling request may lead to usability problems

Posted in Software Development on January 29th, 2010 by Jürgen – Be the first to comment

We are living in the Web 2.0 era, that’s where Web applications load their contents dynamically using an AJAX request or JSONP. One of the more interesting things you can do is push notifications to the browser. Instead of having a timer in the browser firing at a fixed rate, you send a request to server and don’t answer immediately. Whenever an event on the server occurs, you send a notification to the browser over this connection and close it afterwards. The browser in turn, after handling the notification, instantly sends a new request waiting for more events. Because of the nature of that request it is called long-polling. This works really fine, to avoid timeouts by routers or proxies that are between browsers and the server you can send a ‘nothing happened’ notification after a while so that the browser can build a new request.

And now come the real issues. Currently they only apply to Safari browsers. Apple is known for the outstanding usability of their products and so they had a great idea to inform users when Safari is doing background server fetches. Normally, a spinning wheel on the right end of the address field indicates that the browser is loading and during that it appears as selected. Whenever Safari retrieves resources indirectly by referencing them from within the page’s HTML, AJAX or JSONP calls, the spinning wheel does its thing and the background appears in a disabled state.

Safari screenshot

So why do you need to care about this? From a user’s perspective, the Web applications appears as it still hasn’t finished downloading yet. After a while, they refresh the site hoping this will resolve. But doesn’t refreshing the page make the AJAX obsolete? And believe me, user’s will do this. If it doesn’t go away, they turn their interest to someone else’s page, or if you are lucky, they complain.

But the real painful part for you is that the user can, even when the spinning wheel appears disabled, click on the cancel button (the cross) and stop your long-polling request forever!

And what are your workarounds? Okay, Safari users are evil, don’t care about them. Then you should at least notify them before using a browser you do not support. Another alternative is to force users to install the Yahoo! Browser Plus plug-in. This is super-simple, users don’t even need to restart the browser after installation or need administration privileges on their machines, and you get some crazy features like desktop drag’n'drop for free. Browser Plus provides a JSONRequest object that does cross-domain JSON requests in a safe manner.

Another alternative would be to rethink your application model about whether you can avoid pushing data to the browser. Creating Web applications with an exciting user experience is still a complex task. Compared to native applications, browsers, their programming model and JavaScript, are still limiting in so many ways.

Related topics:
Yahoo! Browser Plus

Can Terracotta Dissolve The ORM Mismatch?

Posted in Software Development on May 21st, 2009 by Jürgen – Be the first to comment

The short answer is: No. In many of your projects, you will still find the need of using RDBMSs. And there is nothing evil about RDMSs, as long as you use them for what they are good at, and for what they were designed. Ask a snail to move fast, you will be disappointed. Ask a RDBMS to persist an object graph, you will be disappointed. Hope that Terracotta brings some magic salvation? You will be disappointed, too. read more »

Why Going The Difficult Way?

Posted in Software Development on May 16th, 2009 by Jürgen – Be the first to comment

I often get asked when there is something available on the CoordinateMe website that one can test. So you can get a first impression of the CoordinateMe web service. I have provided some information on the Lindenbook website, and people seem to get curious. My answer is often something like, “It’s not finished yet, I am currently integrating Terracotta.”, or, “It’s not in a usable state yet, I’m learning Spring.”, or, “I’m currently improving my UNIX scripts.” These answers do not tell anything to someone who is not into Java programming. read more »