Ruby gem Stream API like twitter
Is there any gem for ruby (I want to use it in a rails app) that does something like Twitter Stream API. Keep the http conection open a开发者_开发百科nd send information in real time basis, in a query or events.
You need:
- a server that speaks HTTP in order to be able to understand queries and respond valid HTTP to the client
- an asynchronous system that will push updates in the connection established with the client when there's new data available.
Then thin is an options you might consider, it has a builtin http parser for the first requirement, and eventmachine for the second.
Have a look at this example (run it with thin --rackup async_tailer.ru start). It is tailing asynchronously the /var/log/syslog through a open http connection. You can adapt this example to send data from other asynchronous sources from which you would like data to come.
I think twitter-stream should do what you want.
twitterstream gem worked best for me
Twitter Gem has added streaming functionality. you can check that out
精彩评论