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("127.0.0.1", 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.
§Feature flags
By default no features are enabled in this crate, making all of them opt-in by design.
-
builder— The builder feature enables struct builders for all available requests as well as the connection configuration struct.This enables new APIs for constructing instances of the request structs with type-safe builders for convenience, instead of typical struct initialization. It is especially helpful for structs with many optional fields.
For example, have a look at
ConnectConfig::builder. -
events— The event feature enables receiving of user interaction events fromobs-websocket.This is not enabled by default, as it has a large impact on the compilation time. Enabling it is crucial for reacting to user interactions in OBS, but be warned about the noticable compliation time increase.
-
tls— The tls feature enables Transport Layer Security support for the connection to OBS, helpful when securing the connection to a remote instance.
Re-exports§
pub use self::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.
- docs
- Additional documentation, mostly in regards to
obs-websocket, or details outside of direct API elements. - error
- Various error types that can occur while using this crate.
- 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.