sullivan.t
sullivan.t

Reputation: 121

Sinatra server push?

What is the best way to push data from a server written in Sinatra to a client? Think similarly to a chat room, but without Ajax polling every 2500ms.

I know of Juggernaut in Rails, but was curious about Sinatra.

Upvotes: 10

Views: 4957

Answers (1)

Greg Campbell
Greg Campbell

Reputation: 15302

A little googling turned up this blog post by Marc-André Cournoyer, which discusses the asynchronous response feature of the Thin web server and includes a link to an async-sinatra library to do just this. You could also take a look at orbited-ruby, a Ruby implementation of the Orbited Comet server. Both of these appear to be pretty new and untested, so you might have to do a little hacking yourselves to get things working correctly for your application.

Upvotes: 5

Related Questions