0

I have to display timer on client side & that timer should be in sync with server side timer in Spring 3 + Tiles based web application.Whenever I visit the page that contain timer it should be showing server side timings. I need some suggestions and help to implementation of timer.

Milople Inc
  • 399
  • 1
  • 8
  • 34
  • 1
    You may use an Applet to show a timer though websites with a working timer are rarely seen. The server time depends upon its time zone. You may also want to consider an appropriate time zone. Is it absolutely necessary to display a timer? – Lion Apr 12 '13 at 11:32
  • Depending upon the server, sending requests every second/millisecond is not possible. See [long polling](http://stackoverflow.com/q/333664/1037210). You may want to avoid displaying a timer. – Lion Apr 12 '13 at 11:48
  • I have to display timer compulsory. Does atmosphere framework suitable for this timer implementation? – Milople Inc Apr 12 '13 at 11:54
  • A working clock is generally worth, if it works at least on a second range and sending a request to the server every second to fetch the current server time can crash **any** server. Sending a request by a single client within a very small amount of time (a second) is not recommended at all. – Lion Apr 12 '13 at 12:37
  • Thanks for helping me out .I know it would be inappropriate to request at every seconds to sever, But is there any other option to do this ? & Yes applet would be good option to consider. – Milople Inc Apr 12 '13 at 13:11
  • Why have you tagged this with quartz? Are you using some sort of quartz schedule? – darrenmc Apr 12 '13 at 21:44
  • I tried quartz . because from one article I got that quartz can be useful for my timer implemetation. – Milople Inc Apr 13 '13 at 04:11
  • I don't think you need to send a request every second, if you could get fancy with your JavaScript. First, how accurate do you need the time to be? If you answered "fairly accurate", then I think you could get away with sending a request to the server once every 5 or 10 seconds to sync the times between the client and server, then use a JavaScript timer to keep counting down between syncs. Given that most modern-day, Quartz (the chemical, not the framework) driven clocks are accurate within milliseconds, I think at most you are looking at a 1 second derivation in time. – CodeChimp Apr 15 '13 at 12:46

0 Answers0