Periodic RJS Calls?

Howdy Folks,

I have a a button that launches an RJS call and it works beautifully. It
updates a bunch of other areas on the page and brings in the most recent
data. Great stuff!

I would like to enable 'auto-updates' for my app - basically I would like to
have the browser periodically invoke the RJS call so that every 60 seconds
or so, everything is updated.

I know that Prototype has the 'PeriodicalUpdater' but that is based around
AjaxUpdater and from everything I have read and seen, AjaxRequest is used in
RJS, not AjaxUpdater.

Has anyone done anything like this? Can anyone point me in the right
direction and rescue me from meta-refresh hell?

Any help *very* much appreciated.

Cheers,
HH

Hi~

Howdy Folks,

I have a a button that launches an RJS call and it works beautifully. It
updates a bunch of other areas on the page and brings in the most recent
data. Great stuff!

I would like to enable 'auto-updates' for my app - basically I would like to
have the browser periodically invoke the RJS call so that every 60 seconds
or so, everything is updated.

I know that Prototype has the 'PeriodicalUpdater' but that is based around
AjaxUpdater and from everything I have read and seen, AjaxRequest is used in
RJS, not AjaxUpdater.

Has anyone done anything like this? Can anyone point me in the right
direction and rescue me from meta-refresh hell?

Any help *very* much appreciated.

Cheers,

Hey HH-

  You want the periodically_call_remote helper. Its perfect for this. Lets assume the action you want to periodically call is called ping:

<%= periodically_call_remote(:url => {:action => 'ping'}, :frequency => 5) %>

That will call the ping action once every 5 seconds.

-Ezra

Yeah, this works fantastic.

Thanks.