Skip to content

Desuq Cafe

Documentation menu

Request Batching

When you need to send several OBS commands together, the FOBSRequestBatchBuilder fluent API packages them into a single batch request. This is more efficient than sending each request individually and lets you control execution ordering and failure handling.

Basic Usage

Chain the commands you want and call Execute():

FOBSRequestBatchBuilder::Create(OBSClient)
    .SetCurrentProgramScene("Gaming")
    .StartRecord()
    .SetInputMute("Mic/Aux", false)
    .Execute();

With Callback and Options

For full control, add raw requests, set execution options, and receive per-request results in a callback:

FOBSRequestBatchBuilder::Create(OBSClient)
    .AddRequest("GetSceneList")
    .AddRequest("GetInputList")
    .HaltOnFailure(true)
    .SetExecutionType(EOBSRequestBatchExecutionType::SerialRealtime)
    .ExecuteWithCallback([](const FOBSBatchResult& Result) {
        for (const auto& SingleResult : Result.Results)
        {
            // Handle individual results
        }
    });

Execution Types

EOBSRequestBatchExecutionType controls how OBS processes the batch:

TypeDescription
SerialRealtimeProcess requests one at a time, in order, immediately
SerialFrameProcess requests one at a time, in order, on frame boundaries
ParallelProcess requests concurrently (order not guaranteed)

Batch Semantics

Note: Batches have different semantics from single sends. OBS returns one combined result containing a result array, and each entry has its own success/code/comment. There is no per-request timeout inside a batch.

See also