Skip to content

1681-engine / index / LobbyServerMessage

Type Alias: LobbyServerMessage ​

ts
type LobbyServerMessage = 
  | {
  id: number;
  modes: string[];
  t: "lobby/welcome";
}
  | {
  rooms: RoomSummary[];
  t: "lobby/rooms";
}
  | {
  room: RoomState | null;
  t: "lobby/room";
}
  | {
  from: number;
  t: "lobby/chat";
  text: string;
}
  | {
  t: "lobby/kicked";
}
  | {
  code: LobbyErrorCode;
  message: string;
  t: "lobby/error";
}
  | {
  mode: string | null;
  since: number;
  t: "queue/status";
  waiting: number;
}
  | {
  t: "queue/locked";
  until: number;
}
  | {
  expiresAt: number;
  match: string;
  mode: string;
  players: MatchPlayer[];
  t: "match/found";
}
  | {
  accepted: number[];
  match: string;
  t: "match/accepted";
}
  | {
  match: string;
  reason: "declined" | "timeout" | "left";
  requeued: boolean;
  t: "match/cancelled";
}
  | {
  data: unknown;
  match: string;
  mode: string;
  players: MatchPlayer[];
  t: "match/start";
};

Defined in: src/net/lobby/lobbyProtocol.ts:80

Lobby → client.

Union Members ​

Type Literal ​

ts
{
  id: number;
  modes: string[];
  t: "lobby/welcome";
}

Type Literal ​

ts
{
  rooms: RoomSummary[];
  t: "lobby/rooms";
}

Type Literal ​

ts
{
  room: RoomState | null;
  t: "lobby/room";
}

Your room changed (null: you are in none).


Type Literal ​

ts
{
  from: number;
  t: "lobby/chat";
  text: string;
}

Type Literal ​

ts
{
  t: "lobby/kicked";
}

Type Literal ​

ts
{
  code: LobbyErrorCode;
  message: string;
  t: "lobby/error";
}

Type Literal ​

ts
{
  mode: string | null;
  since: number;
  t: "queue/status";
  waiting: number;
}

In the queue since since (server ms), waiting other groups queued for that mode; until set while locked out.


Type Literal ​

ts
{
  t: "queue/locked";
  until: number;
}

Type Literal ​

ts
{
  expiresAt: number;
  match: string;
  mode: string;
  players: MatchPlayer[];
  t: "match/found";
}

Type Literal ​

ts
{
  accepted: number[];
  match: string;
  t: "match/accepted";
}

Type Literal ​

ts
{
  match: string;
  reason: "declined" | "timeout" | "left";
  requeued: boolean;
  t: "match/cancelled";
}

The ready check failed; requeued when you were put back in the queue at your old place.


Type Literal ​

ts
{
  data: unknown;
  match: string;
  mode: string;
  players: MatchPlayer[];
  t: "match/start";
}

Everyone accepted (or the host started the room): go play. data is what the game's onStart returned for you.

Released under the MIT License.