Skip to content

five-on-it / apps/api/src/fleet / Fleet

Interface: Fleet ​

Defined in: apps/api/src/fleet.ts:49

The game servers.

Methods ​

addSeat()? ​

optional addSeat(room, seat): Promise<SeatAnswer>

Defined in: apps/api/src/fleet.ts:81

Adds a seat to a room's run under way for a player the platform placed (POST /rooms/:id/seats with the room secret, SEAT_TIMEOUT_MS at most): the seat's index, or why not and whether that is certain (definite: its server refused it, a 4xx, or no server has the room, so no seat was added) or not (no answer in time, the network, a 5xx: the seat may have been added all the same).

Parameters ​

room ​

string

seat ​
account ​

string = ...

name ​

string = ...

party? ​

string = ...

team ​

string = ...

tier? ​

number = ...

Returns ​

Promise<SeatAnswer>


close()? ​

optional close(room): Promise<boolean>

Defined in: apps/api/src/fleet.ts:73

Closes a room on its server (DELETE /rooms/:id with the room secret: its players disconnected, a run's not ended abandoned); whether a server had it. A fleet that cannot close rooms says nothing (the room's own clocks close it).

Parameters ​

room ​

string

Returns ​

Promise<boolean>


joinUrl() ​

joinUrl(room, account, party?, run?): Promise<string | undefined>

Defined in: apps/api/src/fleet.ts:88

The URL a player joins a room with (a join token in it, naming their party, and in a run's room their run, seat and team), or undefined for a room nobody has.

Parameters ​

room ​

string

account ​

Account

party? ​

string

run? ​
run ​

string

seat ​

number

team ​

string

Returns ​

Promise<string | undefined>


open() ​

open(request): Promise<FleetRoom>

Defined in: apps/api/src/fleet.ts:55

Opens a room for an artifact (or a level that ships with its bundled game: bundled) on the least busy server (a public one with where its chat is moderated; a run's with its run); throws when none takes it.

Parameters ​

request ​
artifactUrl? ​

string

bundled? ​

string

maxPlayers ​

number

minRelease? ​

string

The oldest release that plays the game (its manifest's line): servers of an older one are passed over.

moderationUrl? ​

string

run? ​

{ game: string; id: string; mission: string; playtest?: boolean; reportToken: string; reportUrl: string; seats: object[]; teams: string[]; }

The run the room is for (runs.ts).

run.game ​

string = ...

run.id ​

string = ...

run.mission ​

string = ...

run.playtest? ​

boolean = ...

run.reportToken ​

string = ...

run.reportUrl ​

string = ...

run.seats ​

object[] = ...

run.teams ​

string[] = ...

title ​

string

Returns ​

Promise<FleetRoom>


playUrl() ​

playUrl(level, who?): Promise<string | undefined>

Defined in: apps/api/src/fleet.ts:99

Where a player plays a level that ships (its room's server's …/game?level=), or undefined with no server; for an account, with a join token of the level's room (level-<name>, naming its party), which a server that asks for one (FOI_JOIN=token) checks.

Parameters ​

level ​

string

who? ​
account ​

Account

party? ​

string

Returns ​

Promise<string | undefined>


rooms() ​

rooms(): Promise<FleetRoom[]>

Defined in: apps/api/src/fleet.ts:67

Every open room on every reachable server.

Returns ​

Promise<FleetRoom[]>


roomsOn() ​

roomsOn(server): Promise<object[] | undefined>

Defined in: apps/api/src/fleet.ts:83

The open rooms of the server the API reaches at server (its internal address), or undefined when it does not answer.

Parameters ​

server ​

string

Returns ​

Promise<object[] | undefined>