Project

em-mqtt

0.03
No commit activity in last 3 years
No release in over 3 years
This gem adds MQTT (Message Queue Telemetry Transport) protocol support to EventMachine.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.5.0
>= 0.10.0
~> 3.0.0
>= 0.8.0

Runtime

>= 0.3.0
 Project Readme

ruby-em-mqtt

This gem adds MQTT (Message Queue Telemetry Transport) protocol support to EventMachine, an event-processing library for Ruby.

Installing

You may get the latest stable version from rubygems.org:

$ gem install em-mqtt

It depends upon the mqtt gem to perform packet parsing and serialising.

Synopsis

require 'rubygems'
require 'em/mqtt'

# Publish example
EventMachine.run do
  c = EventMachine::MQTT::ClientConnection.connect('test.mosquitto.org')
  EventMachine::PeriodicTimer.new(1.0) do
    puts "-- Publishing time"
    c.publish('test', "The time is #{Time.now}")
  end
end

# Subscribe example
EventMachine.run do
  EventMachine::MQTT::ClientConnection.connect('test.mosquitto.org') do |c|
    c.subscribe('test')
    c.receive_callback do |message|
      p message
    end
  end
end

Resources

License

The em-mqtt gem is licensed under the terms of the MIT license. See the file LICENSE for details.

Contact