Type Alias SocketEvents

SocketEvents: {
    bounced: [packet: BouncedPacket, data: JSONRecord];
    connected: [packet: ConnectedPacket];
    connectionRefused: [packet: ConnectionRefusedPacket];
    dataPackage: [packet: DataPackagePacket];
    disconnected: [];
    invalidPacket: [packet: InvalidPacketPacket];
    locationInfo: [packet: LocationInfoPacket];
    printJSON: [packet: PrintJSONPacket];
    receivedItems: [packet: ReceivedItemsPacket];
    receivedPacket: [packet: ServerPacket];
    retrieved: [packet: RetrievedPacket];
    roomInfo: [packet: RoomInfoPacket];
    roomUpdate: [packet: RoomUpdatePacket];
    sentPackets: [packets: ClientPacket[]];
    setReply: [packet: SetReplyPacket];
}

An interface with all supported socket events and their respective callback arguments. To be called from SocketManager.

Type declaration

// Print all chat messages to the console when received.
client.socket.on("PrintJSON", (packet, message) => {
console.log(message);
});

// Warn when lost connection.
client.socket.on("Disconnect", () => {
console.warn("Lost connection to the server!");
}