21 releases (6 breaking)

0.7.0 Oct 1, 2024
0.5.0 Sep 13, 2024
0.4.0 Jun 26, 2024
0.2.4 Feb 28, 2024

#1667 in Asynchronous

Download history 108/week @ 2024-07-01 116/week @ 2024-07-29 2/week @ 2024-08-26 147/week @ 2024-09-09 58/week @ 2024-09-16 248/week @ 2024-09-23 182/week @ 2024-09-30 17/week @ 2024-10-07 13/week @ 2024-10-14

464 downloads per month
Used in jarust_plugins

Apache-2.0

105KB
2.5K SLoC

Jarust

The core of jarust.

It under the hood it uses jarust_interface to provide an abstract api for connecting, creating a session, attaching to a plugin, and then communicate with the plugin handle.

It's also the building block for the plugin crate 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

~7–18MB
~255K SLoC