mqtt-client

A fast and lightweight MQTT client
0.1.8 Latest release released

MQTT-Client

A MQTT client built in Crystal.

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  mqtt-client:
    github: 84codes/mqtt-client.cr
  1. Run shards install

Usage

require "mqtt-client"

mqtt = MQTT::Client.new("localhost", 1883)

mqtt.on_message do |msg|
  puts "Got a message, on topic #{msg.topic}: #{String.new(msg.body)}"
end

mqtt.subscribe("foo", qos: 1)

mqtt.publish("foo", "bar", qos: 1)

mqtt.close
mqtt-client:
  github: 84codes/mqtt-client.cr
  version: ~> 0.1.8
License MIT
Crystal 1.1.1

Authors

Dependencies 0

Development Dependencies 0

Dependents 0

Last synced .
search fire star recently