OBS Studio

WebSocket

CastHub offers an managed communication method between the Users' computer and OBS Studio. For example:

async mounted() {
    await super.mounted();

    const { id } = this.identity;

    // Connect to the external WebSocket.
    const ws = await window.casthub.ws(id);

    // Listen to stock events.
    ws.on('ScenesChanged', async () => {
        console.log('Scenes have changed');
    });

    // We can also emit events to change OBS.
    ws.send('SetCurrentScene', {
        'scene-name': 'test-1',
    });
}

If a connection to that specific Identity is already open (For example, when another Module/Automation has already opened it), you will be subscribed to events from that instance straight away and won't need to wait for a new connection to open.

You can find the reference material for supported Events and Commands here.