You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/protocol-api.md
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,21 @@ This document provides the TCP API protocol reference for developers who want to
6
6
7
7
The BalatroBot API establishes a TCP socket connection to communicate with the Balatro game through the BalatroBot Lua mod. The protocol uses a simple JSON request-response model for synchronous communication.
8
8
9
-
-**Host:**`127.0.0.1` (localhost)
10
-
-**Port:**`12346` (default)
9
+
-**Host:**`127.0.0.1` (default, configurable via `BALATROBOT_HOST`)
10
+
-**Port:**`12346` (default, configurable via `BALATROBOT_PORT`)
11
11
-**Message Format:** JSON
12
12
13
+
### Configuration
14
+
15
+
The API server can be configured using environment variables:
16
+
17
+
-`BALATROBOT_HOST`: The network interface to bind to (default: `127.0.0.1`)
18
+
-`127.0.0.1`: Localhost only (secure for local development)
19
+
-`*` or `0.0.0.0`: All network interfaces (required for Docker or remote access)
20
+
-`BALATROBOT_PORT`: The TCP port to listen on (default: `12346`)
21
+
-`BALATROBOT_HEADLESS`: Enable headless mode (`1` to enable)
22
+
-`BALATROBOT_FAST`: Enable fast mode for faster gameplay (`1` to enable)
23
+
13
24
### Communication Sequence
14
25
15
26
The typical interaction follows a game loop where clients continuously query the game state, analyze it, and send appropriate actions:
0 commit comments