Skip to content
Network internalsOverview

raknet.add_send_hook

Represents registration of an outgoing-packet callback.

Aliasesadd_send_hookraknet.addsendhook

Details#

Registers an outgoing-packet callback and returns the same function for removal. Registering does not send a packet. The example registers an empty observer and immediately removes it without altering traffic.

Examples#

Example

Luau
local function observer(packet) end
local callback = raknet.add_send_hook(observer)
print(callback == observer) -- true
raknet.remove_send_hook(callback)