[][src]Crate obws

OBSWS - The obws (obvious) remote control library for OBS

Remote control OBS with the obs-websocket plugin from Rust 🦀.

Example

use anyhow::Result;
use obws::Client;

#[tokio::main]
async fn main() -> Result<()> {
    /// Connect to the OBS instance through obs-websocket.
    let client = Client::connect("localhost", 4444).await?;

    /// Get and print out version information of OBS and obs-websocket.
    let version = client.general().get_version().await?;
    println!("{:#?}", version);

    /// Optionally log-in (if enabled in obs-websocket) to allow other APIs and receive events.
    client.login(Some("password")).await?;

    /// Get a list of available scenes and print them out.
    let scene_list = client.scenes().get_scene_list().await?;
    println!("{:#?}", scene_list);

    Ok(())
}

Re-exports

pub use client::Client;

Modules

client

The client to the obs-websocket API and main entry point.

common

Common data structures shared between requests, responses and events.

events

All events that can be received from the API.

requests

All requests that can be send to the API.

responses

All responses that can be received from the API.

Enums

Error

Errors that can occur while using this crate.

Type Definitions

Result

Result type used throughout the crate that uses Error as default error.