Hi Ricardo,

I have a javascript class, Ajax.Pull, which, I believe, does exactly
what you need: allows a server to push data to the client. By using a
novel XMLHttpRequest technique the mechanism becomes rather more lucid
than other methods.

The server provides a URL which streams JSON content. The client
connects with Ajax.Pull to this URL to receive updates. For example,
your server might stream the following JSON objects like this

  {"temperature": {"time":1184676153,"value":25.54},
      "pressure": {"time":1184676154,"value":1.2}
  };
  {"temperature": {"time":1184676156,"value":25.53},
      "pressure": {"time":1184676158,"value":1.1}
  };

The handler you provided in the client might look like

  function handler(json) {
    $('temperature').innerHTML = json['temperature']['value'];
    $('pressure').innerHTML = json['pressure']['value'];
  }

Unfortunately you need to go around Rails in order to do stream data
like this. It's not so hard to write a small Mongrel handler to do
this - I've done this to implement an upload progress bar. The my code
from the upload progress bar handler contains an example Rails
application. It shouldn't be so hard to modify this upload progress
bar to fit your needs.

http://four.livejournal.com/777996.html
  info for the progress bar mongrel handler
http://four.livejournal.com/777996.html
  explicit instructs for starting the handler
http://tinyclouds.org/svn/ajax_pull/trunk/
  svn repo for the javascript class. it contains another example of
how to write a mongrel handler.

Let me know if you use this - I'd like to see it in action!

ry

p.s. hopefully i haven't sent this message twice - google groups seems
to not be working properly