Popularity
4.8
Growing
Activity
0.0
Declining
16
3
3
Programming language: Crystal
License: MIT License
Tags:
Network Protocols
Latest version: v1.0.2
crystal-mqtt alternatives and similar shards
Based on the "Network Protocols" category.
Alternatively, view crystal-mqtt alternatives based on common mentions on social networks and blogs.
-
simple_rpc
RPC Server and Client for Crystal. Implements msgpack-rpc protocol. -
crystal-json-socket
JSON-socket client & server implementation. Inspired by and compatible with sebastianseilund/node-json-socket -
connect-proxy
crystal lang connect / HTTP proxy implementation -
gopher.cr
A fast, extensible, Gopher-protocol server written in Crystal
Static code analysis for 29 languages.
Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
Promo
www.sonarqube.org
Do you think we are missing an alternative of crystal-mqtt or a related project?
README
Crystal MQTT
A MQTT communication library for crystal lang with pluggable transports
Installation
- Add the dependency to your
shard.yml
:
dependencies:
mqtt:
github: spider-gazelle/crystal-mqtt
- Run
shards install
Usage
require "mqtt/v3/client"
# Create a transport (TCP, UDP, Websocket etc)
tls = OpenSSL::SSL::Context::Client.new
tls.verify_mode = OpenSSL::SSL::VerifyMode::NONE
transport = MQTT::Transport::TCP.new("test.mosquitto.org", 8883, tls)
# Establish a MQTT connection
client = MQTT::V3::Client.new(transport)
client.connect
# Perform some actions
client.publish("steves/channel", "hello", qos: MQTT::QoS::BrokerReceived)
client.ping
# Subscribe to a channel
client.subscribe("$SYS/#") do |key, payload|
# payload is a Bytes slice (to support binary payloads)
content = String.new(payload)
puts "#{key}: #{content}"
end
sleep 5
# Unsubscribe from a channel
client.unsubscribe("$SYS/#")
sleep 1
# Pauses the fibre here until the socket closes (disconnect)
client.wait_close
# You can also explicitly disconnect
client.disconnect