Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

continuous data push

 
wu jong
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35762
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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 ?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • 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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • 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.
 
Balamaci Serban
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 35762
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
No more fooling around. Read this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!