Skip to content

akasamq/masaka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Masaka

Modular, no_std-oriented async MQTT client for Rust, built on mqtt-proto (v3.1.1 / v5). Transport and time sources are pluggable (Tokio TCP vs Embassy TCP).

Features

Feature Meaning
std Standard library–oriented deps (see Cargo.toml).
embassy Embassy-net TCP TcpTransport + Embassy time default.
tokio Tokio TCP TcpTransport + Tokio time default (implies std).
tls Reserved; not wired up.

Do not enable embassy and tokio together

Quick start (Tokio, host)

[dependencies]
masaka = { version = "*", default-features = false, features = ["tokio"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "net", "time"] }
use masaka::{
    protocol::V3Handler, ClientConfig, MqttClient, PublishConfig, QoS,
    transport::TcpTransport,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let transport = TcpTransport::new("127.0.0.1:1883").await?;
    let config = ClientConfig::new("masaka_demo").with_keep_alive(60);
    let mut client = MqttClient::new(transport, V3Handler::new(), config);

    client.connect().await?;

    let topic = masaka::topic!("demo/topic");
    client
        .publish(&topic, b"hello", PublishConfig::qos0())
        .await?;

    Ok(())
}

Building & tests

cargo check
cargo test --no-default-features --features tokio

About

A WIP MQTT client

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages