troubleshooting Question

Can a value that is pushed by the server be accepted on the client browser?

Avatar of Paul Konstanski
Paul KonstanskiFlag for United States of America asked on
DatabasesJavaScript* Client agent
16 Comments4 Solutions65 ViewsLast Modified:

Ten Image Display That Advances by Value Change on Server

I would like to display ten different images on my Website that are controlled by a value in a database.

Here is how I am currently doing it.

I created a function called "currentImage" to make a call to the database to see what the current image is set at. (e.g. numbers 1-10). That number is passed to the browser and stored as a variable called, "activepage".

I then have created a interval function that fires every 10 seconds. It calls the "currentImage" function which checks the DB to see if the current image has changed. If a change is detected then, the browser updates to the new image. If not, it stays the same.

This 10 second call happens as long as the browser is open.

Can This Change be "Pushed" by the Server?

What I am wondering if there is any way that the server could "push" this value to the browser and be accepted without the operator having to acknowledge the push (e.g. that's why I don't believe push notifications will work.)

Heavy Server Load (or is it?)

The above option works fine and it may be the only way. The problem is that let's say a person has their browser open for 10 minutes to watch the images (e.g. like a presentation). Ten minutes is 60 database calls.  If 100 people were on the site at the same time that would be 6000 database calls in ten minutes. Maybe that's not a lot, but it seems to me like it is.

One Time Acceptance Okay

I am okay with a one-time acceptance of the user at the start. In other words upon arrival, a box pops up that says, "I give permission to allow my screen to be updated." But then all subsequent refreshes happen without user intervention.

Bottom Line: Is there a way to do this?

So bottom line, is there any other way to do this other than the client browser making the DB call every 10 seconds?  

Join our community to see this answer!
Unlock 4 Answers and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros