Thursday 27 March 2008

The never ending Web page like Gmail's on domino, is it feasible?

Today I have been thinking about SJAX (I think it should be more corretly PSJAX Pseudo Synchonous JAX) and methods that would allow me to keep the connection open to a client from the server.

I was asked about the feasibility of creating a real time trading room where Ebay Type bidding takes place, but in real time. Bidding rooms last no longer than an hour multiple supplier attendee's each able to see the requirements but not their competitors bids. Where like betting in poker the "current bidder" is passed between the participants.

My intial reaction was to think Java Applet .. then a couple of seconds later an AJAX pages with a timer that polled the server every couple of seconds.. and then what about the never ending web page senario I read about in connection with gmail.

My idea goes along these lines.. (I am sure there is a flashy geeky name for this .. apologies i have no idea what it is)

01. Client logs on to server
02. Client enters bidding "room" by using the normal AJAX method of calling a web agent
03. The agent (one per client) runs and creates Send 99% of the HTML,CSS,JS for the ROOM
04. Then it goes into a loop without closing the connection
while
{
reads "room control" file
is there a response for this client
YES - Send response in an script envelope like this [script]do([actionkey],[actiondata])[/script]
wait for n seconds
}

04. On the client.. I think this is what GMAIL does .. I have a JS function called do() that processes the data as it comes down and does whatever it needs to do based on the key.

05. The client sends data up stream not to this agent but another normal AJAX agent. That agent processes the data and closes with a nominal response BUT updates the ROOM CONTROL file accordingly so that the user gets the response as a DO() command.
this would be how the agent would terminate normally when the client sends a CLOSE request

Now I havent had a go at doing this yet, i will prob have a bash this weekend and see at least if it works. But if any of you have done anything similar I would appreciate your feedback, esp on the admin front. Having long running agents is not a problem for me as a DEV as an ADMIN it makes me nervous, very very nervous.

Steve

4 comments:

Anonymous said...

Hi Steve,

It sounds like the Ext.Updater class would do what you need. Then, if this is domino on the backend and each supplier must authenticate with the app, then each of their bids would create a document that has a Readers field that sets to just their name and any other names allowed to see their bid. Your "room" could then be a folder or view of the bids/docs and your Ext.Update call would then periodically get this data and refresh the UI for you.

Anyway, just a thought :)

Jack

Anonymous said...

Oh, forgot to leave a link to the Ext.Update class.

http://extjs.com/deploy/dev/docs/?class=Ext.Updater

Anonymous said...

Have you checked out Comet? Comet is all about maintaining an "open connection" between the server and client. For example, Google use it in the integration between GMail and GTalk

This link can tell you more:

Comet: Low Latency Data for the Browser

Unknown said...

@Jack - thanks for the tip.. i will investigate that this weekend ... but would i be right in thinking this works along my second thought of .. a settimeout() repeating call? Not that there is anything wrong with that :-)just so I know, This post was caused by my inquisitive mode engaging when I had a look at the gmail method.

@ben.. ditto thanks for the tip and I have had a look and Comet seems to do what I was thinking of, or something very like it. Now ben what are your views on the background agent that would have to run to support it. My problems in summary with my admin head on are that is an agent that will run continuously for an hour or so and being a web agent will run in the HTTP server task.. 10 users means 10 hour long agents .. Hmmmmmm that makes me edgy and lean towards jacks idea which puts the pressure on the client rather than the server.

I think i will have to do some fiddling and see what actually happens.

Thanks to you both :-) you have given me loads to think about

Steve

Disqus for Domi-No-Yes-Maybe