mqtt-client.cr

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
Repository

mqtt-client.cr

Owner
Statistic
  • 3
  • 0
  • 0
  • 0
  • 2
  • about 1 year ago
  • August 9, 2021
License

MIT License

Links
Synced at

Fri, 17 May 2024 10:13:58 GMT

Languages