API
Rooms
Rooms are served by Scoreboat's socket server, not by this API. A client gets in with a ticket:
POST /api/gm/<game_id>/rt/ticket/with its usual bearer token. The answer is aticketand theurlof the socket server.- Connect to
urlwith socket.io 4, passing?ticket=<ticket>. A ticket works once, for half a minute.
The socket server checks the ticket with Scoreboat itself, through
/api/rt/redeem/. That call is for the socket server only, made with a secret
it shares with Scoreboat, and is listed here for completeness.
Once connected, the client sends rooms, create, join, leave and send
events, and hears rooms, joined, left, member_joined, member_left,
message and refused. The GameMaker reference
describes each event's contents.
| Endpoint | Methods |
|---|---|
/api/gm/<game_id>/rt/ticket/ |
POST |
/api/rt/redeem/ |
POST |
/api/gm/<game_id>/rt/ticket/
| Method | What it does | Permission | Game client |
|---|---|---|---|
| POST | A way into the socket server. | gm:<game_id>:realtime |
Yes |
Answers with a ticket, the url of the socket server, and
expires_in, the seconds the ticket is good for. Connect to url
with socket.io, passing ?ticket=. Refused when rooms are off for the
game, or when it requires a signed-in player and none is.
POST
Answers 201:
{
ticket: string,
url: string, // the socket server's address
expires_in: int, // seconds the ticket works for
}
/api/rt/redeem/
| Method | What it does | Permission | Game client |
|---|---|---|---|
| POST | {ticket}, with X-Realtime-Secret. |
None | Yes |
Open as far as the API's tokens go, because the socket server has none: the shared secret is its credential. Without one configured, this is not there at all.
POST
Answers:
{
game: string, // the game's id
player: { id: string, name: string } | null,
settings: {
require_player: boolean,
allow_search: boolean,
allow_create: boolean,
max_room_size: int,
max_rooms: int,
max_message_bytes: int,
messages_per_second: int,
},
fixed_rooms: [{ id: string, name: string, max_members: int, listed: boolean }],
}
This page is generated from Scoreboat's source code, so it always matches the version you are reading it on.