16 releases
new 0.2.9 | May 11, 2024 |
---|---|
0.2.8 | May 7, 2024 |
0.2.7 | Apr 25, 2024 |
0.2.4 | Feb 28, 2024 |
0.1.4 | Jan 28, 2024 |
#1402 in Asynchronous
271 downloads per month
Used in jarust_plugins
64KB
1.5K
SLoC
Jarust
The core of jarust.
It handles:
- Connection
- Sessions
- Handles
- Send messages
- Receive events
- Demultiplexing
Plugins
Checkout the existing plugins: jarust_plugins
Example usage
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::japlugin::Attach;
use serde_json::json;
use tracing_subscriber::EnvFilter;
#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env().add_directive("jarust=trace".parse()?))
.init();
let mut connection = jarust::connect(
JaConfig::new("ws://localhost:8188/ws", None, "janus"),
TransportType::Ws,
)
.await?;
let session = connection.create(10).await?;
let (handle, mut event_receiver) = session.attach("janus.plugin.echotest").await?;
handle
.message(json!({
"video": true,
"audio": true,
}))
.await?;
while let Some(event) = event_receiver.recv().await {
tracing::info!("response: {event:#?}");
}
Ok(())
}
Dependencies
~4.5–7MB
~122K SLoC