Goal of the script: Send command to OBS to make it do something, like switch scenes, change Sources, play a gif, etc.
I've tried using Postman to get an example, and while I can connect, I get errors about the websocket version from the client being out of date when I try and SEND something to the server.
The below script is not run inside of OBS, but it is run on the same machine. I believe it does connect, but the SEND seems to have no effect. The reason for not wanting to use something like obsws_python library is due to some of the limitations (while you can switch scene's you can't switch source as it's not implemented if I read their docs correctly)
I know there are existing bots that do what I want, but I'm trying to learn and would like to do this with my own custom built bot if possible. Any help is appreciated as I've become quite frustrated with my own inability to make this work.
I've tried using Postman to get an example, and while I can connect, I get errors about the websocket version from the client being out of date when I try and SEND something to the server.
The below script is not run inside of OBS, but it is run on the same machine. I believe it does connect, but the SEND seems to have no effect. The reason for not wanting to use something like obsws_python library is due to some of the limitations (while you can switch scene's you can't switch source as it's not implemented if I read their docs correctly)
I know there are existing bots that do what I want, but I'm trying to learn and would like to do this with my own custom built bot if possible. Any help is appreciated as I've become quite frustrated with my own inability to make this work.
Python:
import websocket
import json
def test():
ws = websocket.create_connection("ws://localhost:4444")
scene_data = {
"request-type": "SetCurrentScene",
"scene-name": "TestScene"
}
print(json.dumps(scene_data))
ws.send(json.dumps(scene_data))
ws.close()
test()