Skip to content
Get started

Lobby network

View as Markdown

The lobby network is the reference for network bundles. Velocity stands in front of two Paper servers, lobby and arena. Every player can type /lobby, and a player kicked from a game lands back in the lobby with a message that says why.

Source: examples/lobby-network.

  • Rules for the proxy. network/Lobby.ts imports no Java. The Lobby component has three messages (AskedForLobby, Kicked, Connected) and two Commands (Connect, Tell).
  • The proxy half. network/velocity.ts default-exports Network.make(...) from @minekube/network. It registers /lobby with Network.command, turns Velocity’s kick event into a message, and implements Connect with a connection request whose result is the Connected message.
  • Servers by selector. In the dev network, Velocity finds lobby and arena by label selectors (stage=lobby, game=arena), through the registry. See Labels and selectors.
  • A swap on the proxy. lobby-network.e2e.ts swaps the network bundle for a new revision while the client stays connected, then a backend kicks the player.
  • Every client version. matrix.e2e.ts joins with the official client of each protocol version Velocity lists. Each one must land in the lobby, get /lobby’s answer and survive a kick, on one connection.

From the repository:

Terminal window
mk server --network
mk dev examples/lobby-network

Join localhost. bun test examples/lobby-network runs the rules and replays recordings/lobby-and-kick.ndjson. bun run test:e2e and bun run test:matrix run the end-to-end tests. They need the dev network and Java 25, and the matrix downloads a few GB of clients on its first run.

Was this helpful?