Skip to content

84codes/mqtt-client.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published