Skip to content

1681-engine / index / LobbyHostOptions

Interface: LobbyHostOptions<D> ​

Defined in: src/net/lobby/LobbyHost.ts:17

Type Parameters ​

Type Parameter
D

Properties ​

admit? ​

ts
optional admit?: (data, id) => D;

Defined in: src/net/lobby/LobbyHost.ts:21

Turns a hello's data into the player's public data (validate it here); throw to refuse the player.

Parameters ​

ParameterType
dataunknown
idnumber

Returns ​

D


chatMax? ​

ts
optional chatMax?: number;

Defined in: src/net/lobby/LobbyHost.ts:38

Characters of a chat line (default 200) and of a room name (default 32).


declineLockMs? ​

ts
optional declineLockMs?: number;

Defined in: src/net/lobby/LobbyHost.ts:33

How long one who declined or let the check lapse is kept out of the queue (default 30 s).


listLimit? ​

ts
optional listLimit?: number;

Defined in: src/net/lobby/LobbyHost.ts:36


matchEveryMs? ​

ts
optional matchEveryMs?: number;

Defined in: src/net/lobby/LobbyHost.ts:43

How often the queue is searched (default 1000 ms).


maxRoomPlayers? ​

ts
optional maxRoomPlayers?: number;

Defined in: src/net/lobby/LobbyHost.ts:35

Most players a room may hold (default 8), and rooms listed at once (default 50).


modes? ​

ts
optional modes?: readonly MatchMode[];

Defined in: src/net/lobby/LobbyHost.ts:19

Modes the queue fills (none: rooms only).


nameMax? ​

ts
optional nameMax?: number;

Defined in: src/net/lobby/LobbyHost.ts:39


now? ​

ts
optional now?: () => number;

Defined in: src/net/lobby/LobbyHost.ts:49

Clock and dice, for tests.

Returns ​

number


onJoin? ​

ts
optional onJoin?: (id) => void;

Defined in: src/net/lobby/LobbyHost.ts:46

Parameters ​

ParameterType
idnumber

Returns ​

void


onLeave? ​

ts
optional onLeave?: (id) => void;

Defined in: src/net/lobby/LobbyHost.ts:47

Parameters ​

ParameterType
idnumber

Returns ​

void


onMessage? ​

ts
optional onMessage?: (id, msg) => void;

Defined in: src/net/lobby/LobbyHost.ts:45

The game's own messages (anything the lobby does not handle).

Parameters ​

ParameterType
idnumber
msg{ [k: string]: unknown; t: string; }
msg.tstring

Returns ​

void


onStart? ​

ts
optional onStart?: (match) => unknown;

Defined in: src/net/lobby/LobbyHost.ts:29

Called when a match starts (everyone accepted, or a room's host started). Return what each player is told to go to — a game server's address and a ticket, a room id on this server — as one value for all, or a function of the player's id. Throw to cancel the start (everyone is told it was cancelled and requeued).

Parameters ​

ParameterType
matchLobbyMatch<D>

Returns ​

unknown


random? ​

ts
optional random?: () => number;

Defined in: src/net/lobby/LobbyHost.ts:50

Returns ​

number


ratePerSecond? ​

ts
optional ratePerSecond?: number;

Defined in: src/net/lobby/LobbyHost.ts:41

Messages a player may send a second before they are refused (default 20); three times it closes the socket.


ratingOf? ​

ts
optional ratingOf?: (id, data, mode) => number;

Defined in: src/net/lobby/LobbyHost.ts:23

A player's rating in a mode (default 1000 for everyone). A party queues at its members' mean.

Parameters ​

ParameterType
idnumber
dataD
modestring

Returns ​

number


readyCheckMs? ​

ts
optional readyCheckMs?: number;

Defined in: src/net/lobby/LobbyHost.ts:31

Time to accept a found match (default 15 s); 0 starts it at once.

Released under the MIT License.