API - AlignedCookie88/FireClient GitHub Wiki
What is the API?
The FireClient API is a protocol that allows for programs to interact with FireClient.
Connecting to the API
Currently the API is only available as a websocket, on port 39870
.
General Usage
When using the FireClient API, all packets between your application and FireClient follow a specific pattern, outlined below. However, when connecting to the API it will always send a welcome message, including a link to this page, and the connection id (attribute id
), which is used in the game log when referencing the connection.
Sending a packet
Packets sent to FireClient should always follow the below format
{
"type": "packet_type_name_here",
"data": {
"key1": "value1",
...
}
}
If the packet you are sending does not require any data, simple leave the object empty, do not omit it.
Receiving a packet
When receiving a packet from FireClient, it always will have a success
attribute. After sending a packet to FireClient, you will always receive one back.
"success": true
If the packet you sent has a response, the response data will be in the response
attribute, otherwise the packet will only contain the success value.
"success": false
If the API call was unsuccessful, it will provide an error. See an example below.
{
"success": false,
"error": {
"type": "java.lang.InvalidStateException",
"message": "The error message, if applicable, otherwise null."
}
}
Packet List
identify
)
Identify (id: Sending an identify packet allows FireClient to display your program's name instead of the connection ID, in certain scenarios. It expects a name
argument, where you should supply your program's name. It does not have any response data.
show_toast
)
Show Toast (id: Shows a toast (popup) in the game. It expects a message
argument, where you should supply the message to be shown. It does not have any response data.
do_auth
)
Do Authentication (id: Starts the FireClient Authentication process. See the Authentication page for more information. It accepts a publicKey
argument, and responds with the secretKey
and username
attributes. See Authentication for more info.