Simple MQTT-based chat room client written in Ruby
-
Install and run an MQTT broker. mosquitto is one choice, this also works with RabbitMQ version 3 which includes MQTT support, and with many other MQTT servers.
-
Install the mqtt and ncurses-ruby gems (NB the plain ncurses gem is harder to natively compile)
sudo gem install mqtt ncurses-ruby
-
Run the client
ruby ./mqtt-chat.rb <username>
-
If you want to configure the app to run against an alternative MQTT broker running on a different host/post. Modify this line:
mqtt = MQTT::Client.new('localhost')
replacing 'localhost' with the hostname or IP address of your chosen broker, optionally with a port number, e.g.
mqtt = MQTT::Client.new('m2m.eclipse.org', 1883)
Modified from simple AMQP-based and MQTT-based chat servers originally published as Gists by glejeune
- added exit handler for cleaner end
- updated for newer ruby-mqtt gem
- fixed help text
- updated README