Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Elitriare/ByteNet-Max/llms.txt
Use this file to discover all available pages before exploring further.
definePacket defines a one-way network packet — the ByteNet Max equivalent of a Roblox RemoteEvent. You describe the payload shape with a data type serializer and ByteNet Max handles all buffer writes and reads automatically. The returned object exposes different send methods depending on whether the code runs on the server or the client; calling the wrong method on the wrong side throws an error.
Signature
Parameters
A configuration table describing the packet.
Return value
APacketDef object. The methods available depend on the run context.
Server-only methods
Sends
data to a single player.Broadcasts
data to every player currently in the server. Uses a single buffer write, making it more efficient than iterating with sendTo.Sends
data to each player in the players array.Broadcasts
data to every player except except.Client-only methods
Sends
data from the client to the server.Shared methods
Registers a callback that fires every time the packet arrives. Returns a disconnect function — call it to remove that specific listener.The callback signature is
(data: T, player: Player?) -> (). On the server, player is the sender. On the client, player is always nil.Same as
listen, but the callback fires only once and then automatically disconnects. Also returns a disconnect function if you need to cancel it before it fires.Removes every listener registered on this packet. Useful for cleanup when a system shuts down.
Yields the current thread until the next packet arrives, then returns the data. Implemented with a one-shot listener internally.
Example
ByteNet Max applies a server-side rate limit to incoming client data. By default, each client is allowed up to 8,192 bytes per second. Packets that exceed this budget are silently dropped and a warning is printed to the output. This limit is set via the
MAX_BUFFER_SIZE attribute on the ByteNet Max module instance.