Crate obws

source ·
Expand description

OBWS - 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", 4455, Some("password")).await?;

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

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

    Ok(())
}

Differences to obs-websocket API design

You may notice that several functions are named differently from the original obs-websocket documentation. To help you find the right functions, have a look at docs::mapping.

Re-exports

pub use self::client::Client;

Modules

The client to the obs-websocket API and main entry point.
Common data structures shared between requests, responses and events.
Additional documentation, mostly in regards to obs-websocket, or details outside of direct API elements.
All events that can be received from the API.
All requests that can be send to the API.
All responses that can be received from the API.

Structs

A pair of comparison operator and partial version, such as >=1.2. Forms one piece of a VersionReq.
SemVer version as defined by https://semver.org.

Enums

Errors that can occur while using this crate.

Type Definitions

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