obs-websocket - Remote-control OBS Studio using WebSockets

obs-websocket - Remote-control OBS Studio using WebSockets 5.0.1

Soundchaser

New Member
I've had to revert to OBS v27 as the integrated WebSockets does not sustain a connection. I know this has been reported elsewhere.

I've even tried v28.01 but without success. Is this being actively worked on?
 

Christian Lima

New Member
Hello, is it possible that the obs-websocket 4.x protocol is no longer available? Does anyone have a copy of it? Thank you
Error 404
 

Christian Lima

New Member
I've had to revert to OBS v27 as the integrated WebSockets does not sustain a connection. I know this has been reported elsewhere.

I've even tried v28.01 but without success. Is this being actively worked on?
Não precisa voltar para o v27 do OBS, use obs-websocket 4.9.1-compat. Eu uso para conectando o Deckboard.
No need to go back to v27 of OBS, use obs-websocket 4.9.1-compat. I use it for connecting the Deckboard.
No es necesario volver a la v27 de OBS, use obs-websocket 4.9.1-compat. Lo uso para conectar el Deckboard.

deckboard--web-sockets.png
 

AimbotNooby

New Member
If it may sound interesting for someone, it's possibile to change scenes from an http page though clicking an http link, I've realized a mosaic on a static web page and I can swtich cameras from any device, by browser.
The client and server (websoket obs) should be present on the same network, or on internet if you properly NAT the websocket port (I suggest you to use higher unknow port namber against attacks.
In the http server there should be placed the websockets client, a .js file, I attach it here. In the html should be present:

Code:
<!DOCTYPE html>
<html lang="en">
<head>
    <script type="text/javascript" src="http://192.168.24.2/OBS-WebSocket.js"></script>
    <title>WEBSOCKET TEST</title>
</head>


<body>

    <a align="center" href="#" onclick="setCurrentScene('SCENE-NAME-ON-OBS')">TEST</a>

<script>
function setCurrentScene(scenename) {
const obs = new OBSWebSocket();
    obs.connect({address: '192.168.24.2:4444'
    });
    obs.on('ConnectionOpened', () => {
        obs.send('SetCurrentScene', {
                'scene-name': scenename
         });
    });
    }
</script>
</body>
</html>
Hello I tried making a simple website controlling my OBS and followed Barabba's instruction, but it doesn't work for me.

That's my code:
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="obs-websocket.js"></script>
<title>WEBSOCKET TEST</title>
</head>

<body>
<a href="#" onclick="setCurrentScene('Szene 2')">TEST</a>
<script>
function setCurrentScene(scenename) {
const obs = new OBSWebSocket();
obs.connect({address: '192.168.178.91:4455'
});
obs.on('ConnectionOpened', () => {
obs.send('SetCurrentScene', {
'scene-name': scenename
});
});
}
</script>
</body>
</html>
I also tried a simple way to connect (without the obs-websocket.js) and that works...at least the connection. The scene switch of course not :(
const ws = new WebSocket("ws://192.168.178.91:4455");
ws.addEventListener("open", () => {
console.log("connected!");
});
function ka(scenename){
ws.send('SetCurrentScene', {
'scene-name': scenename
});
}
 

AimbotNooby

New Member
Hello I tried making a simple website controlling my OBS and followed Barabba's instruction, but it doesn't work for me.

That's my code:

I also tried a simple way to connect (without the obs-websocket.js) and that works...at least the connection. The scene switch of course not :(
Ok I solved it by downgrading to OBS 27 and by using the websocket plugin 4.8.
 

kc8iqw

New Member
Running the latest and greatest OBS Studio and consequently the obs-websocket plugin. Why can we not select the local loopback any longer to bind to. It gets a server address, but says (best guess) next to it. I want it bound to local loopback for security reasons.
 

tt2468

New Member
I've had to revert to OBS v27 as the integrated WebSockets does not sustain a connection. I know this has been reported elsewhere.

I've even tried v28.01 but without success. Is this being actively worked on?
Sounds like you've probably got a configuration issue somewhere. Many clients will endlessly try to reconnect after failing to authenticate because they don't have any built-in functionality to show an error dialog.
 

DF3EI

New Member
Not sure if this is the proper place to ask... I am using the latest socket API 5.x and I am able to remotely open a projector (full screen). Is there a simple way to close it again using the API, or at least re-use it? The API call (OpenVideoMixProjector) keeps on opening new instances of the projector every time I call it.
 

napoellis

New Member
I was trying to use TikFinity to control OBS and it needed my Websocket, it wasn't working so I tried to update the plug-in and now it won't load.
 

Simonpoker

New Member
I am experiencing constant disconnections from the OBS WebSocket server. Even though I am able to connect successfully using tools like Insomnia and Python, as soon as I try to send any requests, the server disconnects. I have tried this on multiple computers and networks, ruling out issues with firewall or software version. I have also tried enabling WebSocket debugging, but no errors are reported. Any suggestions on how to resolve this issue?
 

bcoyle

Member
I am experiencing constant disconnections from the OBS WebSocket server. Even though I am able to connect successfully using tools like Insomnia and Python, as soon as I try to send any requests, the server disconnects. I have tried this on multiple computers and networks, ruling out issues with firewall or software version. I have also tried enabling WebSocket debugging, but no errors are reported. Any suggestions on how to resolve this issue?
probably didn't get the correct password sent. obs will disconnect if you send any command without properly doing the password sequence first
 

ironiris

New Member
Hi there,

The source below works fine for the 4.9.1 protocol, but I would appreciate if you could tell me how to get the same behavior for the 5.1.0 protocol.
<!DOCTYPE html>
<html>
<head>
<title>OBS Text Update</title>
</head>
<body>
<div>
<label for="textSource">Text Source:</label>
<input type="text" id="textSource" value="test">
</div>
<div>
<label for="newText">New Text:</label>
<input type="text" id="newText" value="1">
</div>
<div>
<button id="updateText">Update Text</button>
</div>

<script src="https://cdn.jsdelivr.net/npm/obs-websocket-js/dist/obs-websocket.min.js"></script>
<script>
const obs = new OBSWebSocket();

document.getElementById('updateText').addEventListener('click', async () => {
try {
await obs.connect({
address: 'localhost:4444',
password: 'passwd'
});
console.log(`Connected to OBS Studio!`);

const sourceName = document.getElementById('textSource').value;
const newText = document.getElementById('newText').value;

const response = await obs.send('SetTextGDIPlusProperties', {
'source': sourceName,
'text': newText
});

if (response.status === 'ok') {
console.log(`Text updated successfully for source: ${sourceName}`);
} else {
console.error(`Error updating text: ${JSON.stringify(response, null, 2)}`);
}
} catch (error) {
console.error(`Failed to connect to OBS Studio: ${error}`);
} finally {
obs.disconnect();
console.log(`Disconnected from OBS Studio.`);
}
});
</script>
</body>
</html>
 

markusd1984

New Member
Could this plugin be used to set the streaming key?

Instead of having to enter an event specific steam key under settings > stream key, I'd love to use a browser dock or similar to present a text input field to paste the current stream key to use.
 
Top