-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fd925c
commit 7a8ab3d
Showing
3 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
streamerbot/3.api/4.servers/1.websocket/1.events/custom.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: Custom | ||
description: Emit custom events from the Streamer.bot WebSocket server | ||
--- | ||
|
||
## Overview | ||
You can enable `Custom` events with this [Subscribe](/api/servers/websocket/requests#subscribe) request: | ||
|
||
```json [Subscribe Request] | ||
{ | ||
"request": "Subscribe", | ||
"id": "my-request-id", | ||
"events": { | ||
"General": [ | ||
"Custom" | ||
] | ||
}, | ||
} | ||
``` | ||
|
||
## C# Methods | ||
### `WebsocketBroadcastString` | ||
Send a custom string over the Streamer.bot WebSocket server | ||
:csharp-method{name=WebsocketBroadcastString} | ||
::code-group | ||
```cs [Example Request] | ||
CPH.WebsocketBroadcastString("Hello, world!"); | ||
``` | ||
```json [Example Response] | ||
{ | ||
"timeStamp": "2023-01-01-05T00:25:18.2696998+01:00", | ||
"event": { | ||
"source": "General", | ||
"type": "Custom", | ||
"data": "Hello, world!" | ||
} | ||
} | ||
``` | ||
:: | ||
|
||
### `WebsocketBroadcastJson` | ||
Send a custom JSON event over the Streamer.bot WebSocket server | ||
:csharp-method{name=WebsocketBroadcastJson} | ||
::code-group | ||
```ts [Example Request] | ||
CPH.WebsocketBroadcastJson("{'key': 'value'}"); | ||
``` | ||
```json [Example Response] | ||
{ | ||
"timeStamp": "2023-01-01-05T00:25:18.2696998+01:00", | ||
"event": { | ||
"source": "General", | ||
"type": "Custom", | ||
"data": { | ||
"key": "value" | ||
} | ||
} | ||
} | ||
``` | ||
:: |