This is a Ruby implementation of the client for message_bus.
Add this line to your application's Gemfile:
gem 'message_bus_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install message_bus_client
The API is mostly equivalent with the JavaScript client:
client = MessageBusClient.new('http://chat.samsaffron.com/')
client.subscribe('/message') do |payload|
# Do stuff
end
client.start
client.pause
client.resume
client.stop
Both Long Polling and normal polling are supported:
MessageBusClient.long_polling = true # false to disable
MessageBusClient.poll_interval = 15 # seconds
After checking out the repo, run bundle install
to install dependencies. Then, run rake spec
to
run the tests.
If you are running Windows, Ruby is not able to kill the server process. Run it separately using
rake server
before running the specs.
Bug reports and pull requests are welcome on GitHub at https://github.com/lowjoel/message_bus_client.
Released under MIT License.