Archive for October, 2008

Silverlight 2 introduces the ability to “push” data to the client with helper¬†client and server duplex objects and with it opens doors to a much more responsive, scalable world of web applications.

Before Silverlight duplex, God made COMET. You can read more about COMET elsewhere¬†but the important thing to note is that COMET has shortcomings. Because COMET was built on top of existing web technologies rather than designed from the ground up, it suffers problems with firewalls, proxy servers, & of course: browser compatibility. I’m not an expert in COMET technologies nor do I intend to knock it, but Silverlight solves these problems AND makes it a hell of of lot easier for programmers to implement pushing techniques from the server. Note: Microsoft WCF technology has introduced a number of other technologies that have made it more than possible to support push-style behavior for Windows applications already. The new thing here is that you can now do it in a cross platform web app.

Push vs. Pull. Of course there’s always the good ‘ol pull method where the client continues to ask the server if there’s anything new it should tell you about. This works well for scenarios where the server has something to tell the client about most of the time. For example, if the client needed to know what the stats of the ongoing Packers game is, it would be reasonable to just have the client check on a regular basis because you can almost assume that every minute something has changed. But what if the client needed to check if you had a new voice mail? Unless you’re far more popular than I am, 99% of the time that the client would check the server, nothing would different. In this scenario, a push would be a much better choice. Why?

Because it keeps your server scalable. If you have hundreds or thousands of clients all asking your server “is there anything new yet?” every minute, your server is going to be busy. And in scenarios where very little actually changes, it’s all unnecessary work. So give your server a break and let it tell the client when there’s actually something to say. Don’t call me; I’ll call you.

And its fast.There is no faster way for your client to get messages from the server. If you pull the server, you have to configure the client to pull every x seconds or minutes. This means that if something changes on the server right after you checked last, you have to wait until nest time. It’s like when you miss the mail man. Now you’ll have to wait until tomorrow to send that letter. And depending on how important the information is, the ability to tell the client virtually instantly could be a big deal.

We’ve got a problem Houston.With inventions like AJAX & RIAs, more and more web apps are shifting the burden from the server to the client and reducing round trips to the server. However, the drawback is its more likely that the client’s scope will increase and the client will be less likely to get updates from the server. Imagine you had a web page that showed you a list of contacts and allowed to edit info about each. In the old days with frequent round trips, you practically couldn’t do anything without a round trip and therefore a new version of that web page. The bonus was that if a new contact was added to the database, you’d suddenly see the new contact. But now, without extra work on the programmers part, the user is not likely to know about that new contact unless the users clicks back and next to reload the page.

The need isn’t special case. Almost all apps could benefit from push techniques. Not just chat clients and monitoring apps. Does your app support collaboration where another user can change the data they are looking at? In fact, any app where what the user sees information that could conceivably change could use this technique.

Programmers need to push changes to the client and it has to be easy to implement or the quality of our apps will suffer. Fortunately, the Silverlight 2 duplex features accomplish both of these objectives. So lets be good programmers and use these tools to help transform the web into a more scalable, responsive, place. They call it progress.


Read Full Post »