class

Obsctl::OBS::Client

Inherits Reference < Object

obs-websocket 5.x client used by the server-owned OBS supervisor.

Constructors

new(config : Config::Config, event_subscriptions : Int32 | Nil = nil)
Source

Instance methods

audio_snapshot

Fetches only the audio input list for targeted state updates.

Source
close

Closes the WebSocket and marks this client as no longer identified.

Source
connect

Opens the WebSocket, performs Hello/Identify/Identified, and starts the reader fiber used for events and request responses.

Source
connected?

Returns true after Identify completes and the underlying socket is open.

Source
current_scene

Returns the current OBS program scene name when available.

Source
events

Channel of parsed OBS events from opcode 5 frames.

Source
input_muted(name : String) : Bool | Nil

Returns mute state for an OBS input by exact OBS input name.

Source
input_names

Returns current OBS input names.

Source
input_volume(name : String) : NamedTuple(mul: Float64 | Nil, db: Float64 | Nil, percent: Int32 | Nil)

Returns OBS input volume in multiplier, dB, and user-facing percent.

Source
mute(name : String, muted : Bool) : Nil

Sets mute state for an OBS input by exact OBS input name.

Source
output_state
Source
pause_record
Source
profiles
Source
record_status

Returns the full record status, including pause state and timecode.

Source
request(request_type : String, data : JSON::Any | Nil = nil) : Protocol::Response

Sends a typed obs-websocket request frame and waits for the matching request ID response or timeout.

Source
resume_record
Source
scene_collections
Source
scene_names

Returns the current OBS scene names in OBS order.

Source
scene_snapshot

Fetches only the scene list and current scene for targeted state updates.

Source
set_profile(name : String) : Nil
Source
set_scene(name : String) : Nil

Changes the current OBS program scene by exact OBS scene name.

Source
set_scene_collection(name : String) : Nil
Source
set_volume(name : String, percent : Int32) : Nil

Sets OBS input volume using a user-facing 0-100 percentage.

Source
snapshot

Fetches a full state snapshot for publication to local IPC clients.

Source
start_record

Starts recording. OBS returns no data, so the caller re-reads status.

Source
stats
Source
stop_record

Stops recording and returns the written file path when OBS reports one.

Source
telemetry_sample

Fetches the performance and output counters used by the daemon's periodic telemetry poller. OBS exposes bytes rather than bitrate, so the supervisor derives kbit/s from consecutive samples.

Source
terminal_error

Returns the safe terminal connection error that closed this client.

Source
toggle_mute(name : String) : Nil

Toggles mute state for an OBS input by exact OBS input name.

Source
toggle_record
Source
toggle_stream
Source
version

Fetches OBS and obs-websocket version metadata.

Source
wait_for_close(timeout : Time::Span) : Domain::ConnectionFailed | Nil

Waits for the WebSocket reader to observe a terminal close or protocol error, returning the same sanitized error exposed by terminal_error.

Source