Project

ruby-mqtt3

0.0
The project is in a healthy, maintained state
Using Fibers and Fiber.scheduler, so needs ruby 3
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies
 Project Readme

Ruby implementation of MQTT 3.1.1 protocol

Using Fibers and Fiber.scheduler, so needs ruby 3.

QoS 0,1,2 supported

Reconnect

By default reconnect is set to true, and it reconnets after 0,1,2,4,8,16,32,64,128,256,300,300... seconds

If it does not suite you, you can pass a custom function.

SSL

verify peer is always enabled

client cert is supported

ssl param can be true or one of these protocol versions:

OpenSSL::SSL::SSLContext::METHODS => [:SSLv23, :SSLv23_client, :SSLv23_server, :SSLv2, :SSLv2_client, :SSLv2_server, :SSLv3, :SSLv3_client, :SSLv3_server, :TLSv1, :TLSv1_client, :TLSv1_server, :TLSv1_1, :TLSv1_1_client, :TLSv1_1_server, :TLSv1_2, :TLSv1_2_client, :TLSv1_2_server]

Persistence

There are two modes: :persistence_everytime and :persistence_manual

When :persistence_manual, persistence data is in memory, and you have to initiate write to disk manually, for example in a signal handler or periodically

When :persistence_everytime, the file will be written every time the state changes, this can be costly

You have to decide what guarantees you need, I think :persistence_manual is a good default

Not supported

websocket is not supported, but should not be too hard using:

https://github.com/socketry/protocol-websocket or

https://github.com/socketry/async-websocket or

https://github.com/imanel/websocket-ruby and https://github.com/imanel/websocket-eventmachine-client

###MQTT 5.0 not supported, yet

Notes

there were literally no tests, so use it at your own risk :)