AJAX and server timer object

A

aostrik

Hi ALL,

I have an object on the server which listenes for timer and does some
work as soon as the timer fires up.
I need to display the output of this object on the web-client.

Now I try to use AJAX.
As soon as browser has loaded the page I send XMLHttpRequest to servlet
which returns the output of that timer-object to the client.
Is that possible to send a reply to XMLHttpRequest callback function
every time when timer fires up without initiating XMLHttpRequest from
the client?

Or I should use some other technique?

Thank you.
 
O

Oliver Wong

Hi ALL,

I have an object on the server which listenes for timer and does some
work as soon as the timer fires up.
I need to display the output of this object on the web-client.

Now I try to use AJAX.
As soon as browser has loaded the page I send XMLHttpRequest to servlet
which returns the output of that timer-object to the client.
Is that possible to send a reply to XMLHttpRequest callback function
every time when timer fires up without initiating XMLHttpRequest from
the client?

Or I should use some other technique?

You might expose the time remaining to the client, so the client knows
when to check back for an update. For example, the client might ask "Has the
event fired yet?" and your server would check the timer, see that there's 35
seconds left, and respond "No. Ask me again in 35 seconds."

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,175
Messages
2,570,946
Members
47,498
Latest member
yelene6679

Latest Threads

Top