• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

continuous data push

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any web solution where I can continuously push data to my clients

I want to develop a solution where my users who login into my website to get a small box of information that is updated every few seconds

I also want to know if it is a nice idea to have many users establish a connection and keep the same connection until they logout ?

Rich.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rich,
You can't push data to a web based client. You can have the client pool the server every few seconds for updates though. Take a look at iframes or AJAX to see how to do this without repainting the full screen.

Similarly, users do not have a dedicated connection on a web based app. HTTP is a request/response protocol, so the web layer is naturally stateless. And trying to dedicate a database connection would use excessive resources and bring your app to a grinding halt.

You'll also want to look at caching (even if only for a second or two) to avoid performance issues with all that polling.
 
wu jong
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the info.

I have 20 tables that are updated once every 20 seconds. The data in this twenty tables is interfaced via six different webpages that present the data in different views/styles (sometimes these pages act on different subsets of data). My browser based clients need to view this in a refreshed manner and I was wondering if continuous page hits is the nicest idea.

Any other possible approaches ?
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rich,

This type of designing question is coming up all the time. I�m pretty sure you know why you cannot have a servlet pooling data to your web clients; or at least not if you use the standard servlet api. I read once on the net that there is some free open source implementation of servlet api that maintains the connection with the clients (although not sure how it works with http, firewalls, etc). You might do some google search for that.
On the other hand if your clients are internal you might simply tell them that what they want is closed to impossible. The only solution that you can propose to them is to forget about fancy web browsing capabilities and ask them to accept a small standard window that refreshes the data accordingly. That�s it: you�ll implement RMI clients using RMI/IIOP and probably you�ll end up developing a new EJB layer for that. But this time you can use many of the RMI feature including distributed notifications, etc, while your solution is still standard and robust.
Regards.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have an applet that opens a ServerSocket and registers its address with the server. The push from server to applet is far from continuous, though. We only push on certain events, and one or two users who close the browser without unregistering can cause big delays (connect timeout) for everyone.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about some homebrew stuff ->you can make the browser refresh the page, i cannot remember the method, belive that it;s set in the HttpServletResponse refreshing the page every x sec u need, and caching the data not related to the changing info, caching based on a key generated for each user(or for all) kept in a session. If the data update is very irregular or fast i guess the applet solution would work better. But personally i hate applets and a lot of people do.
[ July 17, 2005: Message edited by: Balamaci Serban ]
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Balamaci,
One big issue with refreshing the whole page is that it causes the page to disappear on every refresh. This is really annoying for dial-up users because it can take a while for the page to come back.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic