Updated Websockets (markdown)

WarmUpTill
2022-09-17 19:45:49 +02:00
parent 8d1d7d031a
commit 1213da64fb

@@ -5,6 +5,14 @@ Since version 28 of OBS the obs-websocket plugin is shipped with OBS itself so t
To receive messages the [macro](Macros) condition "Websocket" can be used.
To send messages to other OBS instances the [macro](Macros) action "Websocket" can be used.
## Message types
The supported message types that can be used with the "Websocket" action and condition are "Requests" and "Events".
* Requests (1) are sent to one specific target via the specified connection.
* Events (2) are sent to all clients that are connected to the obs-websocket server the event is emitted from.
![RequestEvent](https://user-images.githubusercontent.com/19472752/190868973-9bbd28e4-5130-4a9d-9b7d-1ee136ac597d.png)
## Websocket condition
![WebsocketCondition](https://user-images.githubusercontent.com/19472752/186740224-38f1d111-0aef-41e0-aa1c-56c77e5088ab.PNG)
@@ -26,9 +34,10 @@ First select the connection you want to send the message to (1).
For more details on how to configure connections have a look at the upcoming sections.
Next enter the message you want to send in the text field at (2).
## Connections
### Adding new connections
A new connection can be added to a websocket action by clicking on the "Add new connection" entry in the connection selection menu.
A new connection can be added to a websocket request action or websocket event condition by clicking on the "Add new connection" entry in the connection selection menu.
![AddConnection](https://user-images.githubusercontent.com/19472752/186740289-c8782b92-68c5-444f-af4d-4166f86e1213.png)
@@ -55,7 +64,7 @@ Next click the "Properties" entry and a dialog like described above will open in
The gear icon will also allow you to rename or remove existing connections.
## Sending messages to the scene switcher from external tools via websocket messages
## Sending messages to the scene switcher from external tools via websocket requests
The scene switcher is using the [obs-websocket protocol](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#callvendorrequest) to send and receive messages.
This can also be used by external tools to send messages, which can be processed by the plugin and thus trigger macros.
@@ -79,7 +88,9 @@ To send a message with the contents `testing` one has to create a `CallVendorReq
}
```
### Example Bitfocus Companion
### Example "Bitfocus Companion"
Below is an example configuration that can be used to send message Requests from "Bitfocus Companion" to the Advanced Scene Switcher plugin.
| Field | Value |
| ----------- | ----------- |
@@ -88,3 +99,23 @@ To send a message with the contents `testing` one has to create a `CallVendorReq
![Websocket](https://user-images.githubusercontent.com/19472752/189492814-8bb944aa-21ee-4cef-8033-87948f893937.PNG)
## Receiving messages from the scene switcher in external tools via websocket events
An example event emitted by the Advanced Scene Switcher containing the message "testing" would be the following:
```
{
"d": {
"eventData": {
"eventData": {
"message": "testing"
},
"eventType": "AdvancedSceneSwitcherEvent",
"vendorName": "AdvancedSceneSwitcher"
},
"eventIntent": 512,
"eventType": "VendorEvent"
},
"op": 5
}
```