Full API Reference¶
Every function, setting and event in GameFuse Multiplayer, on one page. Each row links to the page that explains it with examples.
GameFuse's API, on Colyseus
The multiplayer servers run Colyseus 0.16. You never call Colyseus yourself: GameFuse wraps it in the smaller API below. Room code is a plain object, not a Colyseus Room class; state is yours and is not synced by @colyseus/schema; joining takes a GameFuse ticket instead of client.joinOrCreate. This page is the whole of what you can use. Coming from Colyseus? See the mapping.
There are three parts:
- Room code (
room.js), which runs on the server, one copy per room. Room code reference - The client library in your game: JavaScript, Unity C# or Unreal C++ and Blueprints.
- The
gamefusecommand, which uploads room code. Quick start
Room code¶
Room code is one JavaScript file whose default export is an object with the parts below. The type definitions at the end of this page list every one with its exact types; gamefuse multiplayer init puts them next to your room.js as gamefuse-room.d.ts.
Settings¶
| Setting | Default | Meaning | Details |
|---|---|---|---|
config.minPlayers |
2 | start runs when this many players are in. |
config |
config.maxPlayers |
minPlayers |
1 to 32. Once full, the room takes no more players. | config |
config.tickRate |
20 | update calls a second, 1 to 60. 0 means no loop. |
config |
config.reconnectSeconds |
15 | 0 to 300. How long a dropped player's seat is held. | connection drops |
config.joinAfterStart |
false | Let players join a game already under way, until full or room.lock(). |
room code reference |
matchmaking.waitSeconds |
180 | 5 to 1800. How long a player waits for a match. | custom matchmaking |
matchmaking.everySeconds |
1 | 0.25 to 30. How often findRoom is asked. |
custom matchmaking |
matchmaking.attributes |
none | Up to 20 GameFuse user attribute names to load for findRoom. |
custom matchmaking |
Functions the server calls¶
| Function | When | Details |
|---|---|---|
start(room) |
minPlayers are in. Once. Required. |
room code reference |
update(room, dt) |
tickRate times a second after start. dt in seconds. Under 8 ms on average. |
room code reference |
message(room, player, type, data) |
A player's client sent something (up to 4 KB, 60 a second). | room code reference |
playerJoined(room, player, { midGame }) |
A player joined. midGame is true only with joinAfterStart. |
room code reference |
playerDropped(room, player) |
A player's connection dropped. Their seat is held. | connection drops |
playerReturned(room, player) |
A dropped player is back. Send them what they missed. | connection drops |
playerLeft(room, player, how) |
A player is gone for good. how: 'quit', 'timeout' or 'kicked'. |
connection drops |
gameEnd(room, result) |
Once, after room.end(result). The last chance to save (5 seconds). Required. |
room code reference |
findRoom(player, lobby) |
About every matchmaking.everySeconds for each waiting player. Optional. |
custom matchmaking |
The room¶
| Member | What it is | Details |
|---|---|---|
room.id |
A unique id for the room. | room code reference |
room.code |
The 6-character code friends use to join. | room code reference |
room.players |
Everyone in the room, including held seats: { id, name, seat, connected, options, joinedMidGame }. |
room code reference |
room.state |
Yours, starts as {}. Never sent to anyone by itself. |
room code reference |
room.time |
Seconds since start. |
room code reference |
room.round |
The GameFuse round made at start: { multiplayerGameRoundId, gameRoundIds }, or null. |
saving data |
room.random() |
A number from 0 up to 1. | room code reference |
room.send(player, type, data) |
A message to one player (JSON, up to 64 KB). | room code reference |
room.broadcast(type, data, { except }) |
A message to every connected player, or all but one. | room code reference |
room.after(seconds, fn) |
Runs fn once, later. Returns a function that cancels it. Use instead of setTimeout. |
room code reference |
room.log(...things) |
A line in the room log (gamefuse multiplayer logs and the dashboard). console.log does the same. |
room code reference |
room.lock() |
No one else may join. | room code reference |
room.kick(player, reason) |
Removes a player: their client closes with 'kicked'. |
room code reference |
room.end(result) |
Ends the game: gameEnd, then every client closes with 'ended'. |
room code reference |
A player¶
| Member | What it is |
|---|---|
player.id |
Their GameFuse user id. |
player.name |
Their username (guests look like Guest-1234). |
player.seat |
0, 1, 2... in the order they joined. Kept through a reconnect. |
player.connected |
false while their seat is held. |
player.options |
What their client passed to joinQueue, createRoom or joinRoom. Sent by the client: check it. |
player.joinedMidGame |
true if they joined after start (joinAfterStart). |
Your game's GameFuse data: room.gamefuse¶
Every call returns a promise. At most 120 calls a minute per room; never wait for one inside update. Saving GameFuse data from room code
| Call | Returns |
|---|---|
users.get(userId) |
{ id, username, score, credits, guest, attributes } |
users.addScore(userId, amount) |
{ score } |
users.setScore(userId, score) |
{ score } |
users.addCredits(userId, amount) |
{ credits } |
users.setCredits(userId, credits) |
{ credits } |
attributes.set(userId, key, value) |
{ key, value } |
attributes.remove(userId, key) |
{} |
leaderboard.add(userId, name, score, metadata?) |
{ id } |
leaderboard.get(name, limit?) |
{ entries: [{ user_id, username, score, metadata }] } |
leaderboard.clear(userId, name?) |
{} |
rounds.update(gameRoundId, { score, place, metadata, end_time: true }) |
{ id } |
rounds.finishMultiplayer(multiplayerGameRoundId, metadata?) |
{ id } |
rounds.createMultiplayer({ game_type, metadata, user_ids }) |
{ multiplayer_game_round_id, game_round_ids } |
variables.get() |
{ variables }: your game's variables from the dashboard |
store.items() |
{ items } |
store.give(userId, storeItemId) |
{} |
store.remove(userId, storeItemId) |
{} |
Matchmaking: findRoom(player, lobby)¶
| Member | What it is |
|---|---|
player.id, player.name, player.options |
Who is waiting and what their client sent. |
player.attributes |
The GameFuse attributes named in matchmaking.attributes, as strings. |
player.waitedSeconds, player.secondsLeft |
How long they have waited, and how long until they are told nobody is online. |
lobby.rooms |
Open rooms in this queue with a free seat: { id, code, players, seatsLeft, maxPlayers, started, ageSeconds }. |
lobby.waiting |
Everyone else waiting, oldest first. |
lobby.config |
{ minPlayers, maxPlayers }. |
lobby.join(room) |
Put the player in that open room. |
lobby.create(players?) |
Open a new room for the player, and some of lobby.waiting with them. |
lobby.wait() |
Ask again next time. Returning nothing does the same. |
lobby.reject(message?) |
Send the player away: their joinQueue fails with 'rejected'. |
lobby.random() |
A number from 0 up to 1. |
Not available in room code¶
No setTimeout or setInterval (use room.after and update), no fetch, no require or import() while running, no process, no files. What is not available
JavaScript client¶
new GameFuseMultiplayer(...) from gamefuse-multiplayer, also built into the GameFuse JavaScript SDK's gameFuseFull.js. Browser client reference
| Member | What it does |
|---|---|
new GameFuseMultiplayer({ gameId, gameToken, apiUrl?, autoReconnect? }) |
Makes the client. After GameFuse.setUpGame, the SDK's version needs no options. |
await mp.signInAsGuest() |
Plays as a guest, made once and kept in localStorage. |
mp.useToken(authenticationToken) |
Plays as a signed-in GameFuse player. The SDK's version with no token uses the player signed in with GameFuse.signIn. |
mp.token, mp.isGuest |
The player's authentication token, and whether it is a guest. |
await mp.joinQueue(queue, options) |
Joins a queue (the queue is the game mode). Put clientVersion in options. |
mp.leaveQueue() |
Stops waiting: joinQueue fails with 'cancelled'. |
await mp.createRoom(gameMode?, options) |
Makes a private room. Share room.code. |
await mp.joinRoom(code, options) |
Joins a private room by its code. |
await mp.resume() |
The room this tab was in before a reload, or null. |
room.code, room.me, room.players |
The room's code; you ({ id, name, seat }); the latest player list. |
room.reconnecting, room.closed |
Where the connection is. |
room.send(type, data) |
To your room code's message (up to 4 KB, 60 a second). |
room.leave() |
Leaves on purpose: playerLeft gets 'quit'. |
room.on(event, fn) |
Listens. Returns a function that stops listening. |
| Event | Arguments |
|---|---|
'message' |
(type, data) |
'players' |
(players): [{ id, name, seat, connected }] |
'reconnecting' |
none |
'reconnected' |
none |
'closed' |
(reason, detail): 'ended', 'kicked', 'lost', 'left', 'error' or 'no_match' |
Join errors (error.code): 'no_match', 'rejected', 'cancelled', 'busy'.
Unity C# client¶
GameFuseMultiplayer in the GameFuseCSharp namespace, from the game-fuse-cs package. Unity C# client reference
| Member | What it does |
|---|---|
GameFuseMultiplayerUnity.Create(autoReconnect = true, apiUrl = null) |
Makes the client from GameFuse.SetUpGame, keeps the guest in PlayerPrefs, runs events on the main thread. |
new GameFuseMultiplayer(new GameFuseMultiplayerOptions { ... }) |
Outside Unity: GameId, GameToken, ApiUrl, AutoReconnect, Storage, DispatchImmediately, OnListenerError, HttpHandler. |
await mp.SignInAsGuest(), mp.UseGameFuseUser(), mp.UseToken(token) |
Signing in. |
mp.IsSignedIn, mp.IsGuest, mp.Token |
Who is playing. |
await mp.JoinQueue(queue, options), mp.LeaveQueue() |
Queues. |
await mp.CreateRoom(gameMode, options), await mp.JoinRoom(code, options), await mp.Resume() |
Private rooms and coming back. |
mp.DispatchEvents() |
Runs waiting event listeners now (when DispatchImmediately is false and you are outside Unity). |
room.Code, room.Me, room.Players, room.ReconnectSeconds, room.IsReconnecting, room.IsClosed |
The room. |
room.Send(type, data), room.Leave() |
Sending and leaving. |
room.OnMessage, OnPlayers, OnReconnecting, OnReconnected, OnClosed |
Events. Each returns an Action that removes the listener. |
A failed join throws GameFuseMultiplayerException with Code and Status.
Unreal client¶
The UGameFuseMultiplayer game instance subsystem and UGameFuseRoom, from the game-fuse-cpp plugin. Blueprint node names are in brackets. Unreal C++ client reference
| Member | What it does |
|---|---|
SetGame(Id, Token) [Set Game] |
Use this game instead of the one from UGameFuseManager::SetUpGame. |
SetApiUrl(Url), GetApiUrl() [Set Api Url] |
Only for a GameFuse other than gamefuse.co. |
SetAutoReconnect(bool) [Set Auto Reconnect] |
Off: a dropped connection closes with lost at once. |
SetClientVersion(Version) [Set Client Version] |
Sent as clientVersion when the options have none. |
SignInAsGuest(Callback) [Sign In As Guest] |
Plays as a guest, saved in GameUserSettings.ini. |
UseGameFuseUserToken() [Use GameFuse User Token], UseToken(Token) [Use Token], IsSignedIn() |
Signing in. |
JoinQueue(Queue, Options, Callback) [Join Queue], LeaveQueue() [Leave Queue] |
Queues. Blueprint options are JSON text. |
CreateRoom(GameMode, Options, Callback) [Create Room], JoinRoom(Code, Options, Callback) [Join Room], Resume(Callback) [Resume] |
Private rooms and coming back. |
Room->GetCode(), GetMe(), GetPlayers(), GetReconnectSeconds(), IsReconnecting(), IsClosed() |
The room. |
Room->Send(Type, Value), SendObject(Type, Object), SendJson(Type, Text) [Send (JSON)], Leave() [Leave] |
Sending and leaving. |
OnMessage (type, data JSON text), OnMessageNative (C++, FJsonValue), OnPlayers, OnReconnecting, OnReconnected, OnClosed |
Events, on the game thread. |
A failed join gives FGFMultiplayerError with Message, Code and Status.
The gamefuse command¶
npm i -g gamefuse. Quick start, game modes, upload key and upload API
| Command | What it does |
|---|---|
gamefuse multiplayer init --game-name <name> --game-mode <mode> --game <id> |
Makes <name>-<mode>-gamefuse-multiplayer/ with room.js, gamefuse-room.d.ts, AGENTS.md and multiplayer.json. |
gamefuse multiplayer validate |
Runs the server's check on your room code. Uploads nothing. |
gamefuse multiplayer deploy [--no-activate] [--notes "..."] |
Checks, uploads and (by default) makes it the live version for its game mode. |
gamefuse multiplayer list [--game-mode <mode>] |
Every uploaded version; * marks the live one in each mode. |
gamefuse multiplayer activate <version> |
Makes an older version live again. |
gamefuse multiplayer logs [--follow] |
What your room code logged. |
Colyseus to GameFuse¶
| In Colyseus | In GameFuse |
|---|---|
class MyRoom extends Room |
export default { config, start, update, message, ... } |
onCreate, onJoin, onLeave, onDispose |
start, playerJoined, playerLeft, gameEnd |
this.setSimulationInterval(fn, ms) |
config.tickRate and update(room, dt) |
this.onMessage(type, fn) |
message(room, player, type, data) |
@colyseus/schema state, synced for you |
room.state, plain and private; send what players need with room.send / room.broadcast |
client.send(type, data) |
room.send(player, type, data) |
this.broadcast(type, data, { except }) |
room.broadcast(type, data, { except }) |
this.clock.setTimeout(fn, ms) |
room.after(seconds, fn) |
this.allowReconnection(client, seconds) |
config.reconnectSeconds, playerDropped, playerReturned |
this.lock(), this.disconnect() |
room.lock(), room.end(result) |
client.leave() from the room |
room.kick(player, reason) |
client.joinOrCreate(name, options) |
mp.joinQueue(queue, options) with a GameFuse ticket, or your own findRoom |
client.create / client.joinById |
mp.createRoom / mp.joinRoom(code) |
room.onMessage(type, fn) in the client |
room.on('message', (type, data) => ...) |
room.onStateChange |
Your own 'state' messages from room code |
| Your own server | None: GameFuse runs it |
Type definitions¶
The complete types for room code, exactly as gamefuse multiplayer init writes them to gamefuse-room.d.ts:
// Types for GameFuse Multiplayer room code. Written by `gamefuse multiplayer init`.
//
// Use them from plain JavaScript by putting this line above your default export:
//
// /** @type {import('./gamefuse-room').RoomCode} */
// export default { ... };
//
// Room code runs on the server, one copy per room. It is plain JavaScript with
// the usual built-ins (Math, JSON, Date, Map, Set, typed arrays, Promise) and
// the `room` object below. It has no setTimeout/setInterval (use room.after and
// update), no fetch, no require or import() while running, no process, no files.
/** A player in the room. The same object is passed every time, so `===` works. */
export interface Player {
/** The player's GameFuse user id. Use it with room.gamefuse and as a key in room.state. */
readonly id: number;
/** The player's GameFuse username (guests are named like "Guest-1234"). */
readonly name: string;
/** 0, 1, 2... in the order players joined. A player keeps their seat through a reconnect. */
readonly seat: number;
/** false while the player's connection is down and their seat is being held. */
readonly connected: boolean;
/** What the player's client passed when joining, e.g. joinQueue('1v1', { skin: 'red' }). Sent by the client: do not trust it. */
readonly options: Record<string, unknown>;
/** true if they joined after start(): only possible with config.joinAfterStart. */
readonly joinedMidGame: boolean;
}
/** The third argument of playerJoined. */
export interface JoinInfo {
/** true when the game had already started (config.joinAfterStart): catch this player up. */
midGame: boolean;
}
/** The GameFuse round the host made when the game started. */
export interface Round {
multiplayerGameRoundId: number;
/** Each starting player's own game round id, by player id. Use with room.gamefuse.rounds.update. */
gameRoundIds: Record<string, number>;
}
export interface Config {
/** start() is called when this many players are in. Default 2. */
minPlayers?: number;
/** 1 to 32. Once the room has been full it takes no more players. Default: the same as minPlayers. */
maxPlayers?: number;
/** update() calls per second, 1 to 60. 0 means no loop (then update is not needed). Default 20. */
tickRate?: number;
/** How many seconds a player who lost their connection keeps their seat (0 to 300). Default 15. */
reconnectSeconds?: number;
/**
* May players join a game that has already started? Default false: the room locks when start()
* runs, and anyone else in the queue gets another room. true: they can join until the room is
* full (or room.lock()); playerJoined gets { midGame: true } so you can catch them up, and
* GameFuse adds a game round for them to room.round.
*/
joinAfterStart?: boolean;
}
/**
* Your game's GameFuse data, with full rights for this game only.
* Every call returns a promise and takes time (a network round trip): never
* wait for one inside update(). At most 120 calls a minute per room.
* A failed call rejects with an Error whose message says why.
*/
export interface GameFuseData {
users: {
get(userId: number): Promise<{ id: number; username: string; score: number; credits: number; guest: boolean; attributes: Record<string, string> }>;
addScore(userId: number, amount: number): Promise<{ score: number }>;
setScore(userId: number, score: number): Promise<{ score: number }>;
addCredits(userId: number, amount: number): Promise<{ credits: number }>;
setCredits(userId: number, credits: number): Promise<{ credits: number }>;
};
attributes: {
set(userId: number, key: string, value: string): Promise<{ key: string; value: string }>;
remove(userId: number, key: string): Promise<{}>;
};
leaderboard: {
add(userId: number, leaderboardName: string, score: number, metadata?: object): Promise<{ id: number }>;
get(leaderboardName: string, limit?: number): Promise<{ entries: { user_id: number; username: string; score: number; metadata: unknown }[] }>;
clear(userId: number, leaderboardName?: string): Promise<{}>;
};
rounds: {
/** Updates one player's round. `end_time: true` marks it finished now. */
update(gameRoundId: number, changes: { score?: number; place?: number; metadata?: object; end_time?: true }): Promise<{ id: number }>;
/** Marks the whole multiplayer round finished. */
finishMultiplayer(multiplayerGameRoundId: number, metadata?: object): Promise<{ id: number }>;
/** Makes another round by hand (the host already makes one when the game starts: see room.round). */
createMultiplayer(args: { game_type: string; metadata?: object; user_ids: number[] }): Promise<{ multiplayer_game_round_id: number; game_round_ids: Record<string, number> }>;
};
variables: {
/** Your game's variables from the GameFuse dashboard. */
get(): Promise<{ variables: Record<string, string> }>;
};
store: {
items(): Promise<{ items: object[] }>;
give(userId: number, storeItemId: number): Promise<{}>;
remove(userId: number, storeItemId: number): Promise<{}>;
};
}
/** The room. Passed as the first argument to every function you write. */
export interface Room {
/** A unique id for this room. */
readonly id: string;
/** The 6-character code players can share to join this room, e.g. "K7M2QX". */
readonly code: string;
/** Everyone in the room, including players whose seat is being held. Players who left are removed. */
readonly players: Player[];
/** Yours. Starts as {}. Keep the whole game here. The host never sends it to anyone: use send/broadcast. */
state: Record<string, any>;
/** Seconds since start() was called (0 before that). */
readonly time: number;
/** The GameFuse round made when the game started; null before start, or if GameFuse could not be reached. */
readonly round: Round | null;
/** Your game's GameFuse data. */
readonly gamefuse: GameFuseData;
/** A random number from 0 up to (not including) 1. */
random(): number;
/** Sends a message to one player. `data` must be plain JSON, at most 64 KB. A player who is away does not get it. */
send(player: Player | number, type: string, data?: unknown): void;
/** Sends a message to every connected player, or to all but one. */
broadcast(type: string, data?: unknown, options?: { except: Player | number }): void;
/**
* Runs `fn` once, `seconds` from now (there is no setTimeout). Accurate to one tick
* (or 1/20 s when tickRate is 0). Returns a function that cancels it.
*/
after(seconds: number, fn: () => void): () => void;
/** Writes a line to the room log: `gamefuse multiplayer logs` and the dashboard. console.log does the same. At most 50 lines a second. */
log(...things: unknown[]): void;
/** Stops anyone else joining this room. */
lock(): void;
/** Removes a player. Their client gets closed('kicked', reason) and your playerLeft gets how = 'kicked'. */
kick(player: Player | number, reason?: string): void;
/**
* Ends the game: calls your gameEnd(room, result), then every client gets closed('ended')
* and the room closes. Calling it again does nothing. No other function of yours is called after it.
*/
end(result?: unknown): void;
}
/** What room code must export as its default export. */
/** How players are matched. Every field is optional. See the docs: Multiplayer > Custom Matchmaking. */
export interface MatchmakingSettings {
/** Seconds a player waits for a match before being told "No one is online right now. Try again later." 5 to 1800. Default 180 (3 minutes). */
waitSeconds?: number;
/** How often findRoom is asked about everyone waiting, in seconds. 0.25 to 30. Default 1. Only used with findRoom. */
everySeconds?: number;
/** GameFuse user attribute names to load for each waiting player, e.g. ['skill', 'region']. They appear as player.attributes in findRoom. Up to 20. */
attributes?: string[];
}
/** A player waiting to be matched, as findRoom sees them. */
export interface WaitingPlayer {
/** The GameFuse user id. */
id: number;
name: string;
/** What their client passed to joinQueue(queue, options). */
options: Record<string, any>;
/** The GameFuse user attributes named in matchmaking.attributes (values are strings, as GameFuse stores them). */
attributes: Record<string, string>;
/** Seconds since they joined the queue. Use it to widen what counts as a good match over time. */
waitedSeconds: number;
/** Seconds until they are told nobody is online. */
secondsLeft: number;
}
/** An open room in this queue that still takes players. */
export interface OpenRoom {
id: string;
/** The 6-character room code. null for a room findRoom asked for earlier in this same pass. */
code: string | null;
players: { id: number; name: string; options: Record<string, any>; attributes: Record<string, string> }[];
seatsLeft: number;
maxPlayers: number;
/** Whether start() has been called (rooms that started can still take players until they lock). */
started: boolean;
ageSeconds: number;
}
/** What findRoom returns: made by one of the lobby functions. */
export interface MatchDecision { readonly action: 'join' | 'create' | 'wait' | 'reject' }
/** findRoom's toolbox. A fresh one for each player, showing the effect of the answers given to players before them. */
export interface Lobby {
/** Open rooms in this queue with at least one free seat. */
rooms: OpenRoom[];
/** Everyone else still waiting, oldest first. */
waiting: WaitingPlayer[];
/** This room code's config: { minPlayers, maxPlayers }. */
config: { minPlayers: number; maxPlayers: number };
/** Put the player in this open room. */
join(room: OpenRoom | string): MatchDecision;
/** Open a new room for the player and (optionally) some of lobby.waiting, who go in with them. */
create(players?: (WaitingPlayer | number)[]): MatchDecision;
/** Leave the player waiting; findRoom is asked again next time. (Returning nothing does the same.) */
wait(): MatchDecision;
/** Send the player away: joinQueue rejects with error.code 'rejected' and this message. */
reject(message?: string): MatchDecision;
/** 0 to 1. */
random(): number;
}
export interface RoomCode {
config?: Config;
/** Matchmaking settings. Leave out for the default: 3 minutes to find a match. */
matchmaking?: MatchmakingSettings;
/**
* Optional: decide where each waiting player goes. Without it, a player joins the oldest open
* room in the queue that has players and a free seat, or else opens a new room.
* Called about every matchmaking.everySeconds for each waiting player, oldest first.
* Must be quick and cannot wait for anything (no await): everything it needs is in player and lobby.
*/
findRoom?(player: WaitingPlayer, lobby: Lobby): MatchDecision | void;
/** The game begins: minPlayers have joined. Called once. */
start(room: Room): void | Promise<void>;
/** Called tickRate times a second after start. `dt` is seconds since the last call. Must be quick: under 8 ms on average. Not needed when tickRate is 0. */
update?(room: Room, dt: number): void;
/** Called once after room.end(result). The last chance to save: the host waits up to 5 seconds for room.gamefuse calls made here. */
gameEnd(room: Room, result: any): void | Promise<void>;
/** A player joined. Before start() info.midGame is false; with config.joinAfterStart, players who join a game under way get info.midGame true: send them what they missed. */
playerJoined?(room: Room, player: Player, info: JoinInfo): void;
/** A player's connection dropped. Their seat is held for config.reconnectSeconds. */
playerDropped?(room: Room, player: Player): void;
/** A dropped player is back. They missed everything sent while away: send them the current state. */
playerReturned?(room: Room, player: Player): void;
/** A player is gone for good and already removed from room.players. how: 'quit' (left on purpose), 'timeout' (did not come back in time), 'kicked' (room.kick). */
playerLeft?(room: Room, player: Player, how: 'quit' | 'timeout' | 'kicked'): void;
/** A player's client sent a message (at most 4 KB each, 60 a second per player). `data` is whatever the client sent: check it. */
message?(room: Room, player: Player, type: string, data: any): void;
}