Modules
Realtime Database
Values that the whole game shares and hears live: the version of the game, events, a leaderboard, a lobby. Values live at paths like config/version or lobby/rooms/7.
Reading and listening
const version = await ansekai.realtime.get("config/version");
const page = await ansekai.realtime.list("events", { limit: 50 });
const stop = ansekai.realtime.subscribe("config", (change) => {
console.log(change.path, change.value);
});subscribe gives what is there now and then every change at and under the path. It keeps a connection open, WebSocket when the module is on HTTP, and asks only for what it missed after a reconnect. One connection listens to 32 paths at most.
Writing
Only the panel and server code write, unless a path is Shared. A client writes a shared path with up to 4 KB, server code has the limits of the server.
await ansekai.realtime.set("lobby/players/mira", { ready: true });
await ansekai.realtime.delete("lobby/players/mira");ansekai.realtime.set("events/double-gold", true)
local events = ansekai.realtime.list("events")
ansekai.realtime.delete("events/double-gold")Listening clients hear a write of server code when its run ends well, a run that fails sends nothing.
Rules
The Paths tab of the settings says who reaches a path from a game client. A rule covers everything under its path, the closest rule wins:
| Access | Who reads | Who writes |
|---|---|---|
| Public | Anyone with the game key, even before signing in | Panel and server code |
| Players | Signed in players | Panel and server code |
| Shared | Signed in players | Signed in players too |
| Server | Nobody from a client | Panel and server code |
Paths without a rule are Public unless you change the default. A client that writes where it may not gets read_only_path.
Limits
| What | Limit |
|---|---|
| A path | 256 characters, 16 levels deep |
| Paths of a game | 10,000 |
| A value from a client | 4 KB |
A page of list | 200 values |
Updated November 21, 2026