Skip to main content
definePacket<T>(name, options?): PacketDefinition<T>
Defined in: modules/network/src/shared/packet.ts:72 Declare a packet type.

Type Parameters

T

T = void

Parameters

name

string Name identifying the type on the wire, unique in the game.

options?

PacketOptions<T> = {} Default channel and payload validate check.

Returns

PacketDefinition<T> The packet definition, used by packets.on, read and send.

Example

Throws

When the name is empty or longer than 255 UTF-8 bytes.