aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Data Push Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Data Push" Watch "Data Push" New topic
Author

Data Push

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152
Hi All,

I would like to know about any open source api that can allow my to push data to my UI from the server whenever changes are made to the database.
I think one way to do that is using ajax and if i am not wrong the IE uses activeX control to make the ajax work. Our client dont want to have any extra activeX plug-in to make the ajax work. So i am just wondering that is there any other way to achieve the same thing.

Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It doesn't matter how you wrap things, web applications are request-driven; HTTP was never intended to support push from server to client.


I think one way to do that is using ajax and if i am not wrong the IE uses activeX control to make the ajax work.

You are wrong . Its the XMLHTTPRequest object that the browser uses. That aside, AJAX is still a request driven solution, because it is HTTP based.

Browser based technologies are not really suited to this, with the exception of stuff like Applets, ActiveX, and Flash. However, if you use this sort of thing in a browser you have to consider ignoring the browser altogether and just writing a fat client.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You can do a couple things with AJAX. One is to periodically poll the server for new stuff. That's not really push, it's not immediate and it can add a lot of traffic to your network and server. Another is to make an AJAX request that doesn't respond right away ... the server just sits there until it has something to send you and then it responds. This is pretty near push, but it eats up server resources. In my world - lots of users, lots of traffic - I wouldn't do either of those.

What I have done is an applet that opens a ServerSocket and registers its address with the server at logon. When the server wants to push data it looks up the address and does connect, send, disconnect like any other socket client. True push, very little overhead, connecting is a bit slow if the server wants to send to 10,000 users, the applet requires a JRE and a security file. Not practical on a public site, but works in a corporate world with total control over the workstations.

Any of that illuminating?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
jQuery in Action, 2nd edition
 
subject: Data Push