obs-websocket - Remote-control OBS Studio using WebSockets

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

iSvein

Member
I know that, :P
You can't even target the password text box without that checkbox checked. ;)
What I am saying that it does not save. Below is a link to an animated GIF that shows that there is something in there, but when I type in there to change it to something that I actually know, it will not save, it just defaults to the 8 characters.

https://www.headshotdomain.net/modules/Image_Repository/files/10002/pM2PW0xH4D.gif

I have tried using shorter passwords, larger passwords like I did in that animation, I tried alphanumerical, just numbers, just letters, caps and no caps, and a mix of caps and alphanumerical, and nothing worked. It just won't let me change the password. As for the password that is in there, I do not know what it is because I did not enter a password when I installed this.
aha! That I had to test for myself.
Well, same happens here, but the long password I typed works.
No idea why the window resets the number of dots/stars, but here the password works.
Have you tested the password on a client side?
 

coRpSE

Member
aha! That I had to test for myself.
Well, same happens here, but the long password I typed works.
No idea why the window resets the number of dots/stars, but here the password works.
Have you tested the password on a client side?
Not sure what you mean. I don't know what the password is to test it. Like mentioned before, when I installed it, I skipped the syep for setting a password because I was just testing something and I was going to add it in later. So what's there, I have no idea. Mostly, I was just pointing out the bug so it could be fixed.
 

iSvein

Member
Not sure what you mean. I don't know what the password is to test it. Like mentioned before, when I installed it, I skipped the syep for setting a password because I was just testing something and I was going to add it in later. So what's there, I have no idea. Mostly, I was just pointing out the bug so it could be fixed.
When I installed OBS WebSocket plugin it did not ask for a password during installation.
What I meant is that the *** (stars) in the password box does not represent the number of characters my password is once the window is locked and reopened.
 

BOLL

Member
Today I got the authentication to work and I can talk to OBS. I could not figure out how to toggle visibility of a source myself, maybe I just suck at reading docs, but a web search later and I end up here, and the below worked!
Source Visibility... solved myself...
{
"source": "%name%",
"render": false,
"request-type": "SetSourceRender",
"message-id": "123"
}
Just that, when I went to my actual scene and tried it, it would not, because the source is in a sub-scene, a scene source if you will. Is it actually possible to reference sources in a sub-scene? I've built my main scene around that so I'm scratching my head.
I tried going into Studio mode and made sure my sub-scene was in the preview, but that did not help.
 

bcoyle

Member
i use
"SetSceneItemProperties", Message_ID, "scene-name", Scene_Name, "item", Source_name, "visible", OnOFf)
 

Jelt3

New Member
Is there anyway to control the Multiple-RTMP plugin using OBS-websocket?
To start/stop individual streams and read their status.
 

jemannin

New Member
Is there anyway to control the Multiple-RTMP plugin using OBS-websocket?
To start/stop individual streams and read their status.
I´m also very interested in that! :D
Would be great to use OSC for OBS (is based on obs-WebSocket) with a Multiple-RTMP plugin!
 

Martyats

New Member
I've got the password bug too. After upgrading from v. 4.8.0 to 4.9.0 I've lost all Companion /Streamdeck control over OBS. I was not asked to set a password on first use, and I'm not asked for a password on any subsequent loading. I only see password errors in the log.
Going back to v4.8.0 doesn't work now either.
Need help please!
Thank you
 

JohnLaFrance

New Member
Hello Guys,

sorry if its the wrong thread but one quentin.

If I will use the replay in obs with the websocket. Wich parameter in obs I have to speak on/ to use with websocket?
Wuch Name has the parameter for the replay intern to use it with the websocket?


Thanks for answers
 

Barabba

Member
Hi! I'm not a web expert, I need to create a simple http static page with some buttons (images), clickin on them I want to change scene, there is any way to sent to websocket the command using "href"? May somebody write here an example? Thank you
like:
<div id="e1" class="cc07">
<a href="**something here to send to OBS***"> <br>Click here to change shene</a>
</div>
 

Tim_F

New Member
Hi! I'm not a web expert, I need to create a simple http static page with some buttons (images), clickin on them I want to change scene, there is any way to sent to websocket the command using "href"? May somebody write here an example? Thank you
like:
<div id="e1" class="cc07">
<a href="**something here to send to OBS***"> <br>Click here to change shene</a>
</div>

You could use Javascript or JQuery to target the button or use on-click function to run your commands.
 

Barabba

Member
You could use Javascript or JQuery to target the button or use on-click function to run your commands.
Thank you for your kind answer!
I?m totally a beginner in html code, I don't know how and where to place this JQuery, may you kindly write me a small example?
What I need is just a picture, if I press it I'll open another html page and in the same time send the JQuery, something like this:

Code:
<div id="e0" class="cc08">
        <a curl -XPOST -H "Content-type: application/json" -d '{"scene-name":"Scene2"}' 'http://192.168.24.2:81/emit/SetCurrentScene'>
        <a href="http://192.168.24.2/index.html"><img src="logo.jpg" border="0" alt="Logo" title="Logo"></a>
    </div>
Completely wrong I know, I don't know what means <a, how insert a query on the click event, etc ))
Thank you a lot!
 

Tim_F

New Member
You can not run a cURL command from the browser (I believe with node.js you might), but you will have to use an ajax POST request. So using your code above, it would look something like this:

<div id="e0" class="cc08">
<a href="#" onclick="setCurrentScene('Scene2')">
<img src="logo.jpg" border="0" alt="Logo" title="Logo">
</a>
</div>

<script>
function setCurrentScene(scenename) {
var url = 'http://192.168.24.2:81/emit/SetCurrentScene';
var xhr = new XMLHttpRequest();
xhr.open('POST', url);

xhr.setRequestHeader("Content-Type", "application/json");

xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}
};

var data = '{"scene-name":"'+scenename+'"}';

xhr.send(data);
}
</script>

If you are using PHP then you could use cURL. Just pass the info to php to execute it.

Hope that helps, not enough coffee yet, so I may have left something out, but at least you have somewhere to start with.
 

ASchneider

Member
Hello guys!

I was wondering: is there an easy way of exposing your OBS/websocket instance to the internet, without having to fiddle with port forwarding your network and so on? Maybe a python script or something that could easily relay it to someone else so they could use a solution like OBS Remote (http://t2t2.github.io/obs-tablet-remote/) to control my scenes and sources? Or maybe dock a web service that could work as some kind of relay to the internet...

It would be great to be able to just create a portable version of a custom OBS with this solution and send to someone else, so it would just work on any local network configuration.

Thanks!
 

Tim_F

New Member
Hello guys!

I was wondering: is there an easy way of exposing your OBS/websocket instance to the internet, without having to fiddle with port forwarding your network and so on? Maybe a python script or something that could easily relay it to someone else so they could use a solution like OBS Remote (http://t2t2.github.io/obs-tablet-remote/) to control my scenes and sources? Or maybe dock a web service that could work as some kind of relay to the internet...

It would be great to be able to just create a portable version of a custom OBS with this solution and send to someone else, so it would just work on any local network configuration.

Thanks!

If everything is behind your firewall, then you will have to port forward.

If you are running a remote on a web server that is exposed to the outside, and it can communicate to OBS with it internally, then yes it should be possible.
 

Barabba

Member
Tim_F thank you from heart, you're really kind to write that script, I haven't imagine it was so complicated to send a string. I really hope this script can be useful to other people, I think to have a simple web page (runnng o all platforms without installing nothing) with photos/icons of different scenes makes very simple to change them, a useful remote. When it will works I'll try to open a project to share it to the community.

I've tested it and unfortunately it doesn't work, I've debug it with a sniffere and I've found this:

The browser send the command but I think it misses the object cotaining scene:
E +q@À¨À¨¦FQ&´ô×P²çOPTIONS /emit/SetCurrentScene HTTP/1.1
Host: 192.168.24.2:81
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
Accept: */*
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Origin: null
Connection: keep-alive

The small http server replies this:
Eâ+v@À¨À¨Q¦F´ô×P²)HTTP/1.1 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
Allow: POST
Content-Length: 23
Date: Sat, 01 May 2021 09:47:09 GMT
Server: Python/3.8 aiohttp/3.7.4.post0

I'm using:

Here what the author says:


This code contains two request endpoints. /emit/{requesttype} and /call/{requesttype}.


  • /emit/{requesttype} sends off a websocket event without waiting for a response, and immediately returns a generic {"status":"ok"} json response after sending the event, regardless of whether it errors out on the OBS instance.
  • /call/{requesttype} Makes a full request to obs-websocket, and waits for a response. The recieved response is then returned to the HTTP caller.

If authentication is set, then each request much contain an AuthKey header with the configured password as the value.


A request type is always required, however a json body depends on the underlying request in obs-websocket as to whether any data is necessary.


For a list of request types, refer to the obs-websocket protocol docs

Example cURL commands:

 
Top