Type Alias SocketEvents

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

// 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!");
}
type 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];
}
Index
bounced: [packet: BouncedPacket, data: JSONRecord]

Fires when the client receives a BouncedPacket.

The raw BouncedPacket.

connected: [packet: ConnectedPacket]

Fires when the client receives a ConnectedPacket

The raw ConnectedPacket packet.

This also means the client has authenticated to an Archipelago server.

connectionRefused: [packet: ConnectionRefusedPacket]

Fires when the client receives a ConnectionRefusedPacket.

The raw ConnectionRefusedPacket.

dataPackage: [packet: DataPackagePacket]

Fires when the client receives a DataPackagePacket.

The raw DataPackagePacket.

disconnected: []

Fires when the client has lost connection to the server, intentionally or not.

invalidPacket: [packet: InvalidPacketPacket]

Fires when the client receives a InvalidPacketPacket.

The raw InvalidPacketPacket.

locationInfo: [packet: LocationInfoPacket]

Fires when the client receives a LocationInfoPacket.

The raw LocationInfoPacket.

printJSON: [packet: PrintJSONPacket]

Fires when the client receives a PrintJSONPacket.

The raw PrintJSONPacket packet.

The full plaintext message content.

receivedItems: [packet: ReceivedItemsPacket]

Fires when the client receives a ReceivedItemsPacket.

The raw ReceivedItemsPacket.

receivedPacket: [packet: ServerPacket]

Fires when the client receives any ServerPacket.

Any received ServerPacket. Additional checks on the cmd property will be required to determine the type of packet received.

All specific packet event listeners will fire before this event fires.

retrieved: [packet: RetrievedPacket]

Fires when the client receives a RetrievedPacket.

The raw RetrievedPacket.

roomInfo: [packet: RoomInfoPacket]

Fires when the client receives a RoomInfoPacket.

The raw RoomInfoPacket.

This also means the client has established a websocket connection to an Archipelago server, but not yet authenticated.

roomUpdate: [packet: RoomUpdatePacket]

Fires when the client receives a RoomUpdatePacket.

The raw RoomUpdatePacket.

sentPackets: [packets: ClientPacket[]]

Fires when the client sends an array of ClientPacket.

An array of ClientPacket sent to the server.

setReply: [packet: SetReplyPacket]

Fires when the client receives a SetReplyPacket.

The raw SetReplyPacket.