Showing posts with label Reverse Ajax. Show all posts
Showing posts with label Reverse Ajax. Show all posts

Saturday, June 21, 2008

Single Page Application

Normally web application is developed using multiple html pages. Each html page will form the entire html from start to end and flushed into and rendered by browser. What if the entire page is visualized as partial renderable unit and each rendering will be done using Ajax and updated using DOM/Css/Javascript. So we will get or think of nice MVC in the client side where Controller javascript has its job of controlling lifecycle of renderable unit called widget, view has its job of using pleasant color, layouts (all from CSS), data again as java script objects of model (probably imitated or duplicated from the server side model using javascript to java and visa versa - seam remoting will do the same) So effetivly page will get the only data its need and assembles its mark up in the client side, so no more noise html tags, only protien for the application shuttles between server and client. MVC will utilize Comet, Ajax technique extensivly to acheive the requirement.

Comet, Where and How can I use it?

What is Comet?
It is Server Push, it is also called Reverse Ajax. Please look at wikipedia comet.
If we look at where the break even for new technology occurs, then it involves multiple factors like its capabilities are properly understood and started yielding best result for the technology consumer. Industry support, required skill set all maters. Norammly it will start with bleeding edge technology savy people (risk takers) and percolate gratually to mass.

I use to hear from guys, no body will be fired off buying product(software/hardware) from IBM or Microsoft. It is really safe being with big wics and nobody will question them too. It holds true for even bringing new technology into the fold.

If we look at Ajax, in my experience, I worked with Remote Scripting in year 1999/2000 using applets/hidden Frames. I found this trick from one of IBM's article but I totally clueless to find that old article now. But how Ajax got such a phenomenal lime light in the past few years? It is because some web sites which users frequently visits implemented it and user finds it very useful. One such application is google suggest and microsoft web outlook application. Both used Ajax in a good way. So will the same trend make Comet popular? In my purview, comet will defintely make good choice for couple of use cases.
Lets look at what kind of application now implements Comet (Reverse Ajax)
Meebo, Embedded GTalk in the Gmail are very good example of this kind of technique.

Lets look at some application like
1. Dashboard monitoring, notification alert etc.
2. Stock application
3. Chat
4. Game score display application
5. Whatever application which frequently look for changes in the data from the datastore (DB Server, events, notification system or services)

These application will definitely benefit from the comet kind of technique.
DWR, GWT with comet plugin, JQuery with Comet plugin or Dojo Comet toolkit can be used to enable client side comet.
For Server Side,
Comet needs special support from Server, as it needs to address scalability via effective thread management unlike normal application. Comets need multiple open connections to the client, hence special attention needed.
Servlet 3.o spec defines new API in HttpServletRequest/Response for comet kind of interaction. Jetty has been instrumental in driving comet upto Servlet 3.0.
Glassfish has good support as it has Grizzly nio layer.

Other impact,
Comet enabled application normally needs or frequently establish connections to the server. So in corporate environment, it will normally, when it opened and kept for long, will increase the network or internet usage and will be easily increase internet usage rate and you will get caught for heavy internet usage. This will also applicable for Ajax-polling.