A packaged TouchDesigner component that connects to an obs-websocket server and receives all available events.
- Download the .tox file from the Releases page and place it in a location convenient for your project.
- Drag and drop it into your project.
- Set the Address and Port of the server in the Connection parameters tab. Set the Password if there is one.
- If Auto-Reconnect is enabled, the component will connect to the server automatically.
If Auto-Reconnect is disabled, enable the Active switch to connect to the server.
Once connected, any event data received will be set in the corresponding parameter. This makes the data easy to consume by, for example, connecting a Parameter Execute DAT to the OBSWebSocket component.
Several events are considered "high-volume" and must be individually opted into to receive them. You can do this in the Connection parameters tab. These events are:
- Input Volume Meters
- Input Active State Changed
- Input Show State Changed
- Scene Item Transform Changed
It's possible to enable or disable high-volume events while connected to the server, though doing so will force a reconnect.
All methods and enums mentioned below are promoted via op.OBSWebSocket. Each request type's necessary data can be found in the obs-websocket documentation. All enum values can be found in the source.
Sending a request to OBS starts with creating a Request object.
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
| 1 | RequestType | Request type | ✅ | |
| data | dict | Any necessary data for the request type. | None | |
| id | str | A unique ID. Directly sent back in the response. | uuid4() |
Pass an individual request to SendRequest.
OBSWS = op.OBSWebSocket
basic_req = OBSWS.Request(OBSWS.RequestType.GET_STATS)
success = BSWS.SendRequest(basic_req)
advanced_req = OBSWS.Request(
OBSWS.RequestType.SET_CURRENT_PROGRAM_SCENE,
data={"sceneName": "Some Existing Scene"},
id="unique-id",
)
success = OBSWS.SendRequest(advanced_req)Sending multiple requests is as easy as creating them and passing them to SendBatchRequest as a list.
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
| 1 | list[Request] | A list of requests. | ✅ | |
| execution_type | RequestBatchExecutionType | Changes how the requests are processed. | SERIAL_REALTIME | |
| halt_on_failure | bool | Stops processing requests on failure. | False | |
| id | str | A unique ID. Directly sent back in the response. Separate from individual request IDs. | uuid4() |
OBSWS = op.OBSWebSocket
req1 = OBSWS.Request(OBSWS.RequestType.GET_VERSION)
req2 = OBSWS.Request(OBSWS.RequestType.GET_STATS)
success = OBSWS.SendBatchRequest([req1, req2])
success = OBSWS.SendBatchRequest(
[req1, req2],
execution_type=OBSWS.RequestBatchExecutionType.PARALLEL,
halt_on_failure=True,
id="unique-id",
)If you are considering adding a new feature or change to the project, first create a feature request issue to document it and get feedback before proceeding. If you are considering fixing a bug, first open a bug report issue or search for an existing one.