up-transport-mqtt5

Crates.ioup-transport-mqtt5
lib.rsup-transport-mqtt5
version0.1.0
sourcesrc
created_at2024-11-15 16:23:42.162473
updated_at2024-11-15 16:23:42.162473
descriptionMQTT5 Rust Transport library implementation for Eclipse uProtocol
homepagehttps://github.com/eclipse-uprotocol/up-client-mqtt5-rust
repositoryhttps://github.com/eclipse-uprotocol/up-client-mqtt5-rust
max_upload_size
id1449302
size148,384
(eclipse-uprotocol-bot)

documentation

https://github.com/eclipse-uprotocol/up-spec#readme

README

Eclipse uProtocol Rust MQTT5 Client

Overview

This library implements a uTransport client for MQTT5 in Rust following the uProtocol uTransport Specifications.

Getting Started

Building the Library

To build the library, run cargo build in the project root directory. Tests can be run with cargo test. This library leverages the up-rust library for data types and models specified by uProtocol.

Running the Tests

To run the tests from the repo root directory, run

cargo test

Running the Examples

  1. Start an MQTT broker or use the included Mosquitto broker:
cd tests/mosquitto
docker compose up
  1. Set up your environment (for example with a config file at .cargo/config.toml)

Make sure to set these parameters:

[env]
MQTT_PROTOCOL = "'mqtt' or 'mqtts'"
MQTT_PORT = "8883 for ssl encrypted mqtt"
MQTT_HOSTNAME = "the hostname/ url of the broker"
KEY_STORE = "the .pem file location corresponding to an ssl certificate (if using mqtts)"
PRIVATE_KEY_PW = "the password to the .pem file (if using mqtts)"
CLIENT_NAME = "the name of the eventgrid client (if using mqtts)"
  1. Start the following two examples from your repo root directory.
cargo run --example publisher_example
cargo run --example subscriber_example

This shows an example of a UPMqttClient publishing from one device and a UPMqttClient subscribing to the publishing device to receive data.

Using the Library

The library contains the following modules:

Package uProtocol spec Purpose
transport uP-L1 Specifications Implementation of MQTT5 uTransport client used for bidirectional point-2-point communication between uEs.

Please refer to the publisher_example and subscriber_example examples to see how to initialize and use the UPClientMqtt client.

Commit count: 11

cargo fmt