mqtt-client.cr

MQTT client built in Crystal

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
  • 4
  • 0
  • 0
  • 0
  • 2
  • 2 months ago
  • August 9, 2021
License

MIT License

Links
Synced at

Wed, 01 Jan 2025 15:11:39 GMT

Languages