Skip to content

Commit d0b6f62

Browse files
authored
Do readme stuff
1 parent ed940c7 commit d0b6f62

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
11
# obs-websocket-http
22
A Python-based program that provides HTTP endpoints for obs-websocket
3+
4+
## Installing on Ubuntu:
5+
- Clone/download the repository
6+
- Edit `config.ini` and set the address, port, and authentication details for the HTTP server (leave `authentication_key` empty for no auth). Set your obs-websocket connection settings in the `[obsws]` section.
7+
- `sudo apt update && sudo apt install python3.7 python3-pip`
8+
- `python3.7 -m pip install -r requirements.txt`
9+
- CD into the `obs-websocket-http` directory
10+
- Run with `python3.7 main.py`
11+
12+
## Protocol:
13+
This code contains two request endpoints. `/emit/{requesttype}` and `/call/{requesttype}`.
14+
- `/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.
15+
- `/call/{requesttype}` Makes a full request to obs-websocket, and waits for a response. The recieved response is then returned to the HTTP caller.
16+
17+
If authentication is set, then each request much contain an `AuthKey` header with the configured password as the value.
18+
19+
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.
20+
21+
For a list of request types, refer to the [obs-websocket protocol docs](https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#requests)
22+
23+
## Example cURL commands:
24+
- `curl -XPOST -H "Content-type: application/json" -d '{"sc-name":"Scene 2"}' 'http://127.0.0.1/emit/SetCurrentScene'`
25+
- `curl -XPOST -H 'AuthKey: agoodpassword' -H "Content-type: application/json" -d '{"sc-name":"Scene 2"}' 'http://127.0.0.1/emit/SetCurrentScene'`
26+
- `curl -XPOST -H 'AuthKey: agoodpassword' -H "Content-type: application/json" 'http://127.0.0.1/call/GetSceneList'`

0 commit comments

Comments
 (0)