Neomeng / ruby-mqtt

Pure Ruby gem that implements the MQTT (Message Queue Telemetry Transport) protocol, a lightweight protocol for publish/subscribe messaging.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ruby-mqtt

Pure Ruby gem that implements the MQTT (Message Queue Telemetry Transport) protocol, a lightweight protocol for publish/subscribe messaging.

Installing

You may get the latest stable version from Rubygems:

$ gem install mqtt

Synopsis

require 'rubygems'
require 'mqtt'

# Publish example
MQTT::Client.connect('test.mosquitto.org') do |c|
  c.publish('topic', 'message')
end

# Subscribe example
MQTT::Client.connect('test.mosquitto.org') do |c|
  # If you pass a block to the get method, then it will loop
  c.get('test') do |topic,message|
    puts "#{topic}: #{message}"
  end
end

Limitations

  • Only QOS 0 currently supported

Resources

Contact

About

Pure Ruby gem that implements the MQTT (Message Queue Telemetry Transport) protocol, a lightweight protocol for publish/subscribe messaging.

License:Other


Languages

Language:Ruby 100.0%