Using the WebSocket firehose - TheBlackParrot/DumbRequestManager GitHub Wiki
By default, the WebSocket firehose resides at ws://localhost:13338
. If you need to change this, modify the mod's configuration file (found at UserData/DumbRequestManager.json
)
The WebSocket does not accept any input, it is simply ignored. This is what makes it a "firehose" -- all it does is send data out.
Note
This is only showing an example of how to handle the pressedPoke
event. For more listenable events, see the Events section.
First, establish a WebSocket client connection to ws://localhost:13338
.
- There is no "hello" response, bots that support WebSockets should be able to tell when the connection is established.
Select a requested map in the queue, and press the "Poke" button. You should get a JSON-formatted WebSocket message back that follows this data structure:
{
"Timestamp": 1745374880148,
"EventType": "pressedPoke",
"Data": <map data>
}
We can check which event was triggered by using a conditional on the EventType
variable within the response object. For the poke button specifically, we want pressedPoke
.
Using the map data in Data
, we can send a chat message mentioning the requester that we want their attention for the selected request. Everything we need to do so is in this Data
object.
Note
Data
will be formatted the same way map data is used with the HTTP API. See the Map data object structure for what this will look like.
Tip
For events like queueOpen
, the Data
object won't contain map data, it will be of another type (in this case, a boolean -- true
or false
).
You can see what happens by opening and closing the queue by pressing the toggle on the left side in-game while viewing the request queue.