Skip to content

Mason Service

Getting started

If you are running a custom Mason Service server, you can specify the url to which you wish to connect, otherwise, you’ll be connected to the official one.

const mason = new MasonService({
url: "https://example.com/mason",
});

Here is a table with all MasonService options:

NAMETYPEDESCRIPTION
urlstringTarget URL
proxyAgentConnection proxy

Entering matchmaking

To enter matchmaking, you must first create a party and configure it, once you’re done, you can go ready.

mason.on("socketIoSessionData", (data: SocketIOSessionData) => {
setInterval(() => mason.sendPing(), data.pingInterval);
mason.createParty();
mason.setPartyRegion("vultr-frankfurt");
mason.setPartyGameMode("Solo");
mason.setReady(true);
});

Handling events

Zombslib automatically parses all incoming payloads for you and emits events.

mason.on("friendRequestReceived", (frq: ApiFriendRequest) => console.log(frq));

List of all events and their parameters can be found in the source code, as well as here. It is worth noting that there is an any event.