1681-engine / index / LobbyHostOptions
Interface: LobbyHostOptions<D> ​
Defined in: src/net/lobby/LobbyHost.ts:17
Type Parameters ​
| Type Parameter |
|---|
D |
Properties ​
admit? ​
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 ​
| Parameter | Type |
|---|---|
data | unknown |
id | number |
Returns ​
D
chatMax? ​
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? ​
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? ​
optional listLimit?: number;Defined in: src/net/lobby/LobbyHost.ts:36
matchEveryMs? ​
optional matchEveryMs?: number;Defined in: src/net/lobby/LobbyHost.ts:43
How often the queue is searched (default 1000 ms).
maxRoomPlayers? ​
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? ​
optional modes?: readonly MatchMode[];Defined in: src/net/lobby/LobbyHost.ts:19
Modes the queue fills (none: rooms only).
nameMax? ​
optional nameMax?: number;Defined in: src/net/lobby/LobbyHost.ts:39
now? ​
optional now?: () => number;Defined in: src/net/lobby/LobbyHost.ts:49
Clock and dice, for tests.
Returns ​
number
onJoin? ​
optional onJoin?: (id) => void;Defined in: src/net/lobby/LobbyHost.ts:46
Parameters ​
| Parameter | Type |
|---|---|
id | number |
Returns ​
void
onLeave? ​
optional onLeave?: (id) => void;Defined in: src/net/lobby/LobbyHost.ts:47
Parameters ​
| Parameter | Type |
|---|---|
id | number |
Returns ​
void
onMessage? ​
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 ​
| Parameter | Type |
|---|---|
id | number |
msg | { [k: string]: unknown; t: string; } |
msg.t | string |
Returns ​
void
onStart? ​
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 ​
| Parameter | Type |
|---|---|
match | LobbyMatch<D> |
Returns ​
unknown
random? ​
optional random?: () => number;Defined in: src/net/lobby/LobbyHost.ts:50
Returns ​
number
ratePerSecond? ​
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? ​
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 ​
| Parameter | Type |
|---|---|
id | number |
data | D |
mode | string |
Returns ​
number
readyCheckMs? ​
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.