From: Nicholas Van Weerdenburg Date: 2013-06-14T12:55:05+09:00 Subject: Re: Can I use Sinatra to render dynamic pages? --089e011778f57d598504df15208d Content-Type: text/plain; charset=ISO-8859-1 You should be able to do this without JavaScript by using streaming. Sinatra has a streaming API as of 1.3. Rails 4.0 is adding a "live" mode for similar. However you need to use a supporting web server and hook into the event loop (which Rack exposes). https://gist.github.com/rkh/1476463 offers an example, but note that the heroku app is broken (look at the comments for a link to a patched version). Nick On Thu, Jun 13, 2013 at 5:41 PM, Ruby Student wrote: > Hell Team, > > I wrote a very simple dashboard using *shoes* which basically displays > statistics, every second, of certain type of messages arriving at a queue > under *MQ*. But in order for anyone to use it they have to install *Ruby*, > *shoes *and its requirements. So I started experimenting with *Sinatra *to > re-write my simple application so anyone could point their *browser* and > get the dashboard displayed. I went over the first *basic Sinatra*tutorial but everything appears to be static. Is there any example out > there that shows *Sinatra* dynamically refreshing the page continuously > with new information, in my case message queues information? > > In other words, once the user successfully get the page displayed, from > that point on I want the content to be refreshed dynamically with the new > information without user intervention. > > Thank you > > -- > Ruby Student > --089e011778f57d598504df15208d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
You should be able to do this without JavaScript by u= sing streaming.

Sinatra has a streaming API as of = 1.3. Rails 4.0 is adding a "live" mode for similar.
However you need to use a supporting web server and hook into th= e event loop (which Rack exposes).

https://gist.github.com/rkh/1476463 of= fers an example, but note that the heroku app is broken (look at the commen= ts for a link to a patched version).

Nick

On Thu, Jun 13, 2013 at 5:41 PM, Ruby Student = <ruby.student@gmail.com> wrote:
Hell Team,
I wrote a very simple dashboard using shoes which basically d= isplays statistics, every second, of certain type of messages arriving at a= queue under MQ. But in order for anyone to use it they= have to install Ruby, shoes and its requirement= s. So I started experimenting with Sinatra to re-write my simple app= lication so anyone could point their browser and get the dashboard d= isplayed. I went over the first basic Sinatra tutorial but everythin= g appears to be static. Is there any example out there that shows Sinatr= a dynamically refreshing the page continuously with new information, in= my case message queues information?

In other words, once the user successfully get the page disp= layed, from that point on I want the content to be refreshed dynamically wi= th the new information without user intervention.

Thank y= ou

--
Ruby Student

--089e011778f57d598504df15208d--