An MQTT 5.0 client.
The transport lifecycle, request pipeline, keep alive and reconnection all
live in MQTT::ClientBase. What follows is the 5.0 specific half.
The substantive difference from 3.1.1 is that acknowledgements now carry a
reason: a PUBACK can say the publish was rejected, and a SUBACK can reject
individual filters. Those are raised rather than resolved
Instance methods
assigned_client_id
The identifier the broker assigned when we sent an empty one
Sourceauthenticator=(authenticator : Authenticator | Nil)
Sourceconnect(username :
String |
Nil = nil, password :
String |
Nil = nil, keep_alive :
Int32 = 60, client_id :
String =
MQTT.generate_client_id, clean_start :
Bool = true, session_expiry_interval :
UInt32 |
Nil = nil, receive_maximum :
UInt16 |
Nil = nil, will_flag :
Bool = false, will_qos :
Int32 |
QoS = 0, will_retain :
Bool = false, will_topic :
String |
Nil = nil, will_payload :
String |
Bytes |
Nil = nil, will_delay_interval :
UInt32 |
Nil = nil, timeout :
Time::Span |
Nil = @timeout, keep_alive_active :
Bool = true) :
Connack Sourcedisconnect(send_msg = true, reason : ReasonCode = ReasonCode::Success) : Nil
Sourcedisconnect_reason
Why the broker closed the connection, when it said
Sourceparse_message(io)
Handles a decoded packet. Implemented per protocol version
Sourceping(timeout : Time::Span | Nil = @timeout) : Nil
Sends whatever this protocol version uses for a liveness check, and waits
for the response
Sourcepublish(topic : String, payload = "", retain : Bool = false, qos : QoS = QoS::FireAndForget, content_type : String | Nil = nil, response_topic : String | Nil = nil, correlation_data : Bytes | Nil = nil, message_expiry_interval : UInt32 | Nil = nil, payload_format_indicator : UInt8 | Nil = nil, user_properties : Enumerable(Tuple(String, String)) | Nil = nil, timeout : Time::Span | Nil = @timeout)
Sourcepublish_received(pub : Publish)
Sourcereauthenticate(timeout : Time::Span | Nil = @timeout) : Nil
Re-authenticates an established connection, MQTT-4.12.1. The broker
answers with further challenges and finally an AUTH carrying Success,
or drops the connection
Sourceserver_maximum_packet_size
Sourceserver_receive_maximum
What the broker told us it will accept, from the CONNACK
Sourceserver_reference
Where the broker told us to go instead, from a CONNACK or a DISCONNECT
Sourceserver_retain_available?
Sourceserver_shared_subscriptions_available?
Sourceserver_subscription_identifiers_available?
Sourceserver_topic_alias_maximum
Sourceserver_wildcard_available?
Sourcesession_expiry_interval
The session expiry the broker settled on, which may differ from ours
Sourcesubscribe(*topics, qos : QoS = QoS::FireAndForget, no_local : Bool = false, retain_as_published : Bool = false, retain_handling : RetainHandling = RetainHandling::SendAlways, identifier : UInt32 | Nil = nil, timeout : Time::Span | Nil = @timeout, &callback : String, Bytes, Bool -> Nil)
Sourcesubscribe(filters : Enumerable(String), callback : Callback, qos : QoS = QoS::FireAndForget, no_local : Bool = false, retain_as_published : Bool = false, retain_handling : RetainHandling = RetainHandling::SendAlways, identifier : UInt32 | Nil = nil, timeout : Time::Span | Nil = @timeout)
Full form, also used by the block version above
Sourceunsubscribe(*topics, timeout : Time::Span | Nil = @timeout)
Sourceuse_topic_aliases=(use_topic_aliases : Bool)
Use topic aliases when the broker offers them. Saves repeating a topic
string on every publish; set false to always send the topic
Sourceuse_topic_aliases?
Use topic aliases when the broker offers them. Saves repeating a topic
string on every publish; set false to always send the topic
Source