OBS-Websocket & cURL/API call support

As OBS-Websocket matures, it’s gaining incredible power to control OBS directly over websockets. Changing overlays, setting text in sources, activating filters, activating hotkeys, etc.

Currently, you can set alias/alerts to pull in an image or alert into an overlay, but it would be incredibly powerful to also allow direct access to pushing websocket commands directly to OBS, securely.

For instance, setting OBS_KEY_F14 as an instant replay trigger, you could set your bot up to be able to trigger the instant replay with something like:

type=websocket url='localhost:4444/?sendjson="TriggerHotkeyBySequence={'keyId':'OBS_KEY_F14'}"'

A full list of OBS-Websocket protocol items can be found here. While there could be some really neat 2-way data (getting current scene data, etc) and being able to deliver it back to the requester via the bot, initially just having sendjson available would allow at least one-way communication to OBS.

To be able to run websocket connection, we should probably use overlay functionality to connect bot on some server with local network obs. Thus we need configuration for url (which should be accessible from localnet), password, IP filtering as well (get IP of client https://www.cloudflare.com/cdn-cgi/trace)

We can use obs-websocket-js/samples/web-sample at master · haganbmj/obs-websocket-js · GitHub.

As we have overlays dynamically generated, dynamic URL with IP filtering and password through HTTPS we should have enough security protection to do it this way.

Then we should create registry similar to custom variables, where we will set logic of commands sent to websocket (this needs to be thought out more)

We will be able to trigger items of registry by command e.g. !obs-websocket run <id> <?param> or through event listeners.

@CurseAtMe I cannot find anything about sendjson= in docs. Is it documented somewhere or it is just showcase of pseudocode?

Whoops - My mistake, all of the apps blur together in my mind lately.

sendjson is a command option for obscommand, not obs-websockets directly. IIRC, obscommand has support for a bunch of documented features, but in the event where they don’t have a parsed command support, that’s where the sendjson comes in…

1 Like

This topic was automatically closed 0 minutes after the last reply. New replies are no longer allowed.