AJAX question: delayed update of messages

Hello,

I’d like to start a process on the server and update the client with
information about the process, such as

‘starting application …’ (wait 20 seconds) ‘done’

and so on. Which strategy should I use? I have tried to use multiple
render :update do |page| … end, but this is not allowed (OK,
obviously). And somthing like:

page.insert_html :bottom, ‘textarea’, ‘before sleep’
sleep(20)
page.insert_html :bottom, ‘textarea’, ‘after sleep’

did not work because both messages are sent back at the same time(?). So
what could I do to update the browser’s text? I know of
periodically_call_remote, but that way I’d have to remember the state on
the server side, right?

Patrick

Patrick G. wrote:

Hello,

I’d like to start a process on the server and update the client with
information about the process, such as

‘starting application …’ (wait 20 seconds) ‘done’

and so on. Which strategy should I use? I have tried to use multiple
render :update do |page| … end, but this is not allowed (OK,
obviously). And somthing like:

page.insert_html :bottom, ‘textarea’, ‘before sleep’
sleep(20)
page.insert_html :bottom, ‘textarea’, ‘after sleep’

did not work because both messages are sent back at the same time(?). So
what could I do to update the browser’s text? I know of
periodically_call_remote, but that way I’d have to remember the state on
the server side, right?

Patrick

The periodicalUpdater from the prototype js library might be what you
want.
See http://www.prototypejs.org/api/ajax/periodicalUpdater and
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000959

Hello,

The periodicalUpdater from the prototype js library might be what you
want.
See http://www.prototypejs.org/api/ajax/periodicalUpdater and
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000959

But then I’d have to remember the state of that client on the server,
right? I mean: all the output generated between two periodical Updater
requests has to be saved and then sent to the client. This is something
I’d like to avoid if it is possible.

Patrick

backgroundrb? not sure

On Sun, May 4, 2008 at 10:08 AM, Patrick G.

Patrick G. wrote:

Roger P. wrote:

backgroundrb? not sure

That’s a cool thing! Not really solving the problem I have here, but it
will solve other problems!

Thanks,

Patrick

I googled with the keyword “AJAX push” and it came with a few
interesting results
What about this:
http://home.flowdev.de/wordpress/index.php (Look for RTRails)
http://www.lightstreamer.com/
http://www.pushlets.com/

Roger P. wrote:

backgroundrb? not sure

That’s a cool thing! Not really solving the problem I have here, but it
will solve other problems!

Thanks,

Patrick

Danny H. wrote:

Patrick G. wrote:

Roger P. wrote:

backgroundrb? not sure

That’s a cool thing! Not really solving the problem I have here, but it
will solve other problems!

Thanks,

Patrick

I googled with the keyword “AJAX push” and it came with a few
interesting results
What about this:
http://home.flowdev.de/wordpress/index.php (Look for RTRails)
http://www.lightstreamer.com/
http://www.pushlets.com/

Hello Danny,

thanks for the keywords, somehow these didn’t come into my mind. I have
not implemented anything yet, but this will guide me in the right
direction. Thans again!

Patrick

You might want to check out the juggernaut gem and associated plugin.
In short, it sticks a little flash app into your page which ultimately
allows you to push from the webserver to the client browser. There
are various options for identifying clients and channels so the
messages you push can be as broad or restricted as you like.
Typically you end up pushing javascript to the client to update the
state of the page.

On May 5, 3:10 pm, Patrick G. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs