| Crates.io | sylvia-iot-broker |
| lib.rs | sylvia-iot-broker |
| version | 0.3.10 |
| created_at | 2023-03-05 15:02:12.334328+00 |
| updated_at | 2025-09-19 16:21:28.979615+00 |
| description | The message broker module of the Sylvia-IoT platform. |
| homepage | |
| repository | https://github.com/woofdogtw/sylvia-iot-core.git |
| max_upload_size | |
| id | 801494 |
| size | 2,669,548 |
The message broker module of the Sylvia-IoT platform.
This module provides:
You can simply mount sylvia-iot-broker into your axum App:
use axum::Router;
use clap::App as ClapApp;
use std::net::SocketAddr;
use sylvia_iot_broker::{libs, routes};
use tokio::{self, net::TcpListener};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let args = ClapApp::new("your-project-name").get_matches();
let conf = libs::config::read_args(&args);
let broker_state = match routes::new_state("/broker", &conf).await {
Err(e) => {
println!("Error: {}", e);
return Ok(());
},
Ok(state) => state,
};
let app = Router::new().merge(routes::new_service(&broker_state));
let listener = match TcpListener::bind("0.0.0.0:1080").await.unwrap();
axum::serve(listener, app.into_make_service_with_connect_info::<SocketAddr>()).await
}
Please see src/bin/sylvia-iot-broker.rs to get the real world example.