Skip to main content

Module mqtt

Module mqtt 

Source
Expand description

The C ABI for the MQTT transport.

These functions wrap [pamoja_mqtt] for callers that reach the SDK through the flat C boundary. Because that boundary has no async support, the crate owns a single multi-threaded Tokio runtime and each call blocks on it until the underlying async operation completes; a host that wants concurrency runs these calls on its own threads. The shared transport sits behind an async mutex, mirroring the Node and Python bindings so behavior matches across languages.

Structs§

PamojaMqttClient
An opaque handle to an MQTT client transport.
PamojaMqttConfig
Connection settings for an MQTT client.
PamojaMqttMessage
An opaque handle to a message received from a subscribed topic.
PamojaMqttTls
How a connection is secured with TLS, conventionally on port 8883.
PamojaMqttWill
A message the broker publishes on the client’s behalf if its connection ends without a disconnect: the network dropped, the power failed, or the keep-alive ran out.

Enums§

PamojaQos
MQTT delivery guarantee, mirroring the protocol’s quality-of-service levels.

Functions§

pamoja_mqtt_client_connect⚠
Connects to the broker and starts the background event loop.
pamoja_mqtt_client_disconnect⚠
Closes the connection and stops the background event loop.
pamoja_mqtt_client_free⚠
Releases an MQTT client handle.
pamoja_mqtt_client_is_connected⚠
Reports whether the client currently holds an active connection.
pamoja_mqtt_client_new⚠
Creates a disconnected MQTT client from the given settings.
pamoja_mqtt_client_publish⚠
Publishes a payload to a topic.
pamoja_mqtt_client_publish_with⚠
Publishes a payload to a topic with options of its own, optionally waiting for the broker to acknowledge it.
pamoja_mqtt_client_recv⚠
Awaits the next message from any subscribed topic.
pamoja_mqtt_client_recv_within⚠
Waits a limited time for the next message from any subscribed topic.
pamoja_mqtt_client_subscribe⚠
Subscribes to a topic filter.
pamoja_mqtt_message_free⚠
Releases a message handle.
pamoja_mqtt_message_payload⚠
Returns a pointer to a message’s payload bytes.
pamoja_mqtt_message_payload_len⚠
Returns the length in bytes of a message’s payload.
pamoja_mqtt_message_topic⚠
Returns the topic a message was published to.