Server detects change in data

My fundamental lack understanding of Rails and the architecture of the
'Net wil be demonstrated by the following question:

The following is a contrived example:

Assume I have several users looking at (identical) screens. Say, there
is some slowly changing stock market data that they are all looking at.
The price of the stock changes, say, once every minute.

Assume that a Rails application detects a change to the price and wants
to push the change out to the users without the users needing to do
anything? How does one make that happen?

Ralph Shnelvar wrote:

My fundamental lack understanding of Rails and the architecture of the
'Net wil be demonstrated by the following question:

The following is a contrived example:

Assume I have several users looking at (identical) screens. Say, there
is some slowly changing stock market data that they are all looking at.
The price of the stock changes, say, once every minute.

Assume that a Rails application detects a change to the price and wants
to push the change out to the users without the users needing to do
anything? How does one make that happen?

One doesn't, at least not without using Flash, Java, or Comet. Web
technologies don't do push.

The best you can do is to have the client poll the server every so
often.

Best,

or Web Sockets soon (trunk builds of Firefox & Google chrome support
this I believe)

Fred

You could have a page with some javascript that polls your main server every X seconds and redraw the page as required.

However with a lot of users and a small value of X your server is going to complain.

Marnen Laibow-Koser wrote:

One doesn't, at least not without using Flash, Java, or Comet. Web
technologies don't do push.

The best you can do is to have the client poll the server every so
often.

Can this polling be done with jQuery? Can one point to an example?

Ralph Shnelvar wrote:

Marnen Laibow-Koser wrote:

One doesn't, at least not without using Flash, Java, or Comet. Web
technologies don't do push.

The best you can do is to have the client poll the server every so
often.

Can this polling be done with jQuery?

Yes.

Can one point to an example?

Do you really need an example? It's just a matter of periodically
making Ajax requests (or refreshing a page, which is the same thing on
the server side).

Best,

Marnen Laibow-Koser wrote:

Can one point to an example?

Do you really need an example? It's just a matter of periodically
making Ajax requests (or refreshing a page, which is the same thing on
the server side).

Yes, a nice small Ajax query being made from javaScript or jQuery would
be very nice.