Go to file
tt2468 a8d27ede9e Base: Add request batch execution types
A new `executionType` field has been added to the `RequestBatch` Op

Types added:
- `OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_REALTIME`(default)
- `OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_FRAME`
- `OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_PARALLEL`

`OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_REALTIME`:
- Same as how request batches have always worked.
- Requests are processed in-order
- Requests are processed as soon as possible by one worker thread
- The `Sleep` request blocks execution for a specified amount of real
world time

`OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_FRAME`:
- New!
- Requests are processed in-order
- Requests are processed on the graphics thread. BE VERY CAREFUL NOT
TO OVERLOAD THE GRAPHICS THREAD WITH LARGE REQUESTS. A general rule
of thumb is for your request batches to take a maximum of 2ms per
frame of processing.
- Requests processing starts right before the next frame is composited.
This functionality is perfect for things like `SetSceneItemTransform`
- The `Sleep` request will halt processing of the request batch for
a specified number of frames (ticks)
- To be clear: If you do not have any sleep requests, all requests in
the batch will be processed in the span of a single frame
- For developers: The execution of requests gets profiled by the OBS
profiler under the `obs-websocket-request-batch-frame-tick` name.
This value (shown in the OBS log after OBS shutdown) represents the
amount of time that the graphics thread spent actively processing
requests per frame. This tool can be used to determine the amount of
load that your request batches are placing on the graphics thread.

`OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_PARALLEL`:
- New!
- Requests are processed asynchronously at the soonest possible time.
- Requests are processed by the core obs-websocket thread pool, where
the number of workers == the number of threads on your machine.
  - If you have 12 threads on your machine, obs-websocket will be able
to process 12 requests at any given moment.
- The `results` array is populated by order of request completion.
Consider the order to be random.
- The `Sleep` request will return an error if attempted to be used in
this mode.
- Note: This feature is experimental and can increase the chances of
causing race conditions (crashes). While the implementation is fully
thread-safe, OBS itself is not. Usage of this is only recommended if
you are processing very large batches and need the performance benefit.
- Example use case: Performing `SaveSourceScreenshot` on 8 sources
at once.
2021-09-26 03:12:29 -07:00
.github Revert "CI: Build against OBSProject Qt distribution" 2021-09-24 18:26:34 -07:00
CI CI: Don't need these anymore 2021-04-28 20:34:46 -07:00
cmake everything: Massive amount of changes who knows 2021-04-26 08:46:11 -07:00
data/locale Base: Add system tray notifications 2021-06-13 03:58:15 -07:00
deps SettingsDialog: Mild refactor and add Connect Info dialog 2021-05-08 04:29:03 -07:00
docs docs(ci): Update generated docs - b9b8e38 [skip ci] 2021-09-04 17:58:05 +00:00
installer Installer: Fail if OBS is not installed 2021-09-12 00:22:11 -07:00
src Base: Add request batch execution types 2021-09-26 03:12:29 -07:00
.editorconfig Initial commit for attempted rewrite 2021-03-08 03:56:43 -08:00
.gitignore GitIgnore: Ignore generated installer file 2021-08-30 02:51:14 -07:00
.gitmodules SettingsDialog: Mild refactor and add Connect Info dialog 2021-05-08 04:29:03 -07:00
BUILDING.md Docs: Update BUILDING.md ci badge 2021-06-09 00:06:03 -07:00
CMakeLists.txt Base: Add request batch execution types 2021-09-26 03:12:29 -07:00
CONTRIBUTING.md Docs: Update contributing doc 2021-06-14 23:31:42 -07:00
crowdin.yml Initial commit for attempted rewrite 2021-03-08 03:56:43 -08:00
LICENSE Initial commit for attempted rewrite 2021-03-08 03:56:43 -08:00
README.md README: Move simpleobsws to the correct section 2021-09-10 01:37:59 -07:00
SSL-TUNNELLING.md Initial commit for attempted rewrite 2021-03-08 03:56:43 -08:00

obs-websocket

YOU HAVE STUMBLED UPON THE DEV BRANCH FOR V5.0.0

  • You can find the main protocol spec here: PROTOCOL.md.
  • You can find the planned requests sheet here

WebSockets API for OBS Studio.

CI Multiplatform Build Discord Financial Contributors on Open Collective

Downloads

Binaries for Windows, MacOS, and Linux are available in the Releases section.

Homebrew

If you're using MacOS you can use Homebrew for installation as well:

brew install obs-websocket

Using obs-websocket

Here is a list of available web clients: (compatible with tablets and other touch interfaces)

  • (No known clients supporting 5.0.0)

It is highly recommended to protect obs-websocket with a password against unauthorized control. To do this, open the "Websocket server settings" dialog under OBS' "Tools" menu. In the settings dialogs, you can enable or disable authentication and set a password for it.

(Psst. You can use --websocket_port(value), --websocket_password(value), and --websocket_debug(flag) on the command line to override the configured values.)

Possible use cases

  • Remote control OBS from a phone or tablet on the same local network
  • Change your stream overlay/graphics based on the current scene
  • Automate scene switching with a third-party program (e.g. : auto-pilot, foot pedal, ...)

For developers

The server is a typical Websockets server running by default on port 4444 (the port number can be changed in the Settings dialog). The protocol understood by the server is documented in PROTOCOL.md.

Here's a list of available language APIs for obs-websocket :

We'd like to know what you're building with or for obs-websocket. If you do something in this fashion, feel free to drop a message in #project-showoff in the discord server!

Securing obs-websocket (via TLS/SSL)

If you are intending to use obs-websocket outside of a LAN environment, it is highly recommended to secure the connection using a tunneling service.

See the SSL tunnelling guide for easy instructions on how to encrypt your websocket connection.

Compiling obs-websocket

See the build instructions.

Translations

Your help is welcome on translations.

Please join the localization project on Crowdin

Contributors

Code Contributors

This project exists thanks to all the people who contribute. Contribute.

Financial Contributors

Become a financial contributor and help us sustain our community. Contribute

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. Contribute