Method BroadcastCustomEventAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
BroadcastCustomEventAsync(object, CancellationToken)
Sends a custom event to every client of OBS Studio that listens to the general events, this model included, and returns when OBS Studio has accepted it.
public Task BroadcastCustomEventAsync(object data, CancellationToken cancellationToken = default)
Parameters
dataobjectThe data of the event: an object (the fields and their values), for example
new { source = "my app", message = "hello" }, or a JsonElement. It can not be empty.cancellationTokenCancellationTokenA token that ends the wait. A change that was not sent yet is not sent.
Returns
- Task
A task that completes when OBS Studio has answered.
Remarks
The event arrives as CustomEvent, here and in every other program that is connected. It is a way for programs that control one OBS Studio to talk to each other. See SetEnabledAsync(bool, CancellationToken) for the order of changes.
Exceptions
- ArgumentNullException
datais null.- ArgumentException
datais not an object, or can not be written as JSON.- ObsNotConnectedException
There is no connection to OBS Studio. Nothing was changed.
- ObsNotReadyException
OBS Studio is changing its scene collection, or did so after the call. Nothing was changed.
- ObsUnknownOutcomeException
OBS Studio did not answer in time, or the connection ended: it is not known whether it sent the event.
- ObsResponseException
OBS Studio refused the request (the data is empty, for one).