> I have a
Java Swing applet in my site. It talks to server via Applet to
> Servlet Communication. There is one application running at the server > side, which processes some order. > > Now the functionality which I have to build is that the application > should be able to push orders to the applets, so that the users who are > currently watching the applet should be able to see the latest data > automatically without sendinga request. > > I searched on web but couldn't find anything as to how can I push data > to all the connected applets of the site. The applet is not really connected. It just requested sth. and got a response. > > The solution which I thought is the applet will poll the server after > every say 1 minute to check if there is any new to show. But suppose the > number of user is more and there is nothing new to show, the applets > will unnecessary making the request to the server. See below. > > I can't use Socket connection or RMI as the site will browsed outside > the firewall. Is there any way by which I can push data from server to > applets, so that when ever new thing will come server will make > connection with applets and push data thereby using network only when > needed. Unlike in polling the network is used unnecessarily. > I think what you're asking for is not possible since HTTP is a request-response-oriented protocoll (I don't think that's the correct expression, anyway), i.e. you can only respond to requests that have been sent. You can't "connect" to an applet from a servlet using HTTP without the applet sending a request first. Period. So IMO you have four options: a) use polling (īlike you already said this could cause bandwith problems. However you could minimize this effect: let your servlet create a static page on the server whenever sth. changed and let your applet request this page and compare it to the one it requested earlier. In case sth. changed the applet now asks the servlet for new data). b) RMI :) c ) sockets :) (both would cause a limitation of the possible user community, wouldn't it?) d) check JavaWorld's archives (I dont' have the URL here at the moment) for an article explaining how to use client-side scripts to emulate a server-side push (actually, I'm not sure if this really is an option) HTH! -mw > Regards > Bhushan > |
- Pushing data to an Applet Bhushan Bhangale
- Re: Pushing data to an Applet Ross Rankin
- Re: Pushing data to an Applet Bhushan Bhangale
- SV: Pushing data to an Applet Klosa Uwe
- Re: Pushing data to an Applet Bhushan Bhangale
- Cookie Shivani
- Re: Cookie Richard Yee
- Re: Cookie Eric Noriega
- Re: Cookie Shivani
- Re: Cookie Eric Noriega
- Re: Pushing data to an Applet Michael Weller
- Re: Pushing data to an Applet Paul Copeland
- Re: Pushing data to an Applet Bhushan Bhangale
- Re: Pushing data to an Applet Joe Chen
- Re: Pushing data to an Applet Matt Penner
- Re: Pushing data to an Applet Bhushan Bhangale
- Re: Pushing data to an Applet Paul van Beukering