No commit activity in last 3 years
No release in over 3 years
Implements a client for Message Bus, with communication over HTTP
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.45
 Project Readme

MessageBusClient

Build Status

This is a fork of lowjoel's message_bus-client with improvements we've been wanting to merge in. Because that repository is no longer active, this gem has been released as message_bus_client.

This is a Ruby implementation of the client for message_bus.

Installation

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

Upgrading from MessageBus::Client

  1. Change Gemfile gem "message_bus-client" to gem "message_bus_client"
  2. Change configuration:
  • MessageBus.long_polling = true to MessageBusClient.configuration.long_polling = true
  • MessageBus.poll_interval = 15 to MessageBusClient.configuration.poll_interval = 15
  • or...
MessageBusClient.configure do |c|
  c.long_polling = true
  c.poll_interval = 15
end
  1. Change calls to MessageBus::Client.new to MessageBusClient.new

Usage

The API is mostly equivalent with the JavaScript client:

client = MessageBusClient.new('http://chat.samsaffron.com/')
client.subscribe('/message') do |payload, message_id|
  # Do stuff
end

client.start
client.pause
client.resume
client.stop

Both Long Polling and normal polling are supported:

MessageBusClient.configure do |c|
  c.long_polling = true # false to disable
  c.poll_interval = 15 # seconds
end

Development

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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bloom-solutions/message_bus_client.

MIT License

Released under MIT License.