disconnect.
Parameters
function
required
Called as
callback(record) for each outgoing packet.Returns
number
The listener id, for
disconnect.Behavior
- Passive only. To rewrite or drop a packet use
add_send_hook. - Errors are contained. A callback that raises is logged and skipped; it does not break the transport or stop other listeners.
- Keep it short. This runs on the network path, so heavy work there costs throughput.
Example
Errors
Related
on_receive: the inbound equivalent.disconnect: remove the listener.