# sender

Node.js-side outbound pipeline: packets in, sealed frames out.

`createSender(label, sendPacket, logger, seal, onDrop?)` builds a [`Sender`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/sender/#api-Sender) from a [`SendPacketFn`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/sender/#api-SendPacketFn) transport callback (typically a TCP socket write, a `process.send` IPC call, or a `WebSocket.send`) and the session's [`PacketSealer`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/#api-PacketSealer) ([`protocol.seal`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/#api-Protocol-prop-seal)). `sender.send(origin, target, data)` validates the packet synchronously, then a single seal queue produces each wire frame in order and hands it to the callback; a packet the sealer rejects is reported through [`onDrop`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/#api-ChannelOptions-prop-onDrop) rather than thrown. The sender exposes [`stop`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/sender/#api-Sender-prop-stop), [`resume`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/sender/#api-Sender-prop-resume), and [`queue.size`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/sender/#api-OutboundQueue-prop-size) for backpressure. Pair with [`/node/receiver`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/receiver.md) on the other end and a protocol from [`/node/v3`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/v3.md) or [`/node/v4`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/v4.md); a channel from [`/node/channel`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/channel.md) creates both for you.

Function signatures match [`/browser/sender`](https://www.hyperfrontend.dev/docs/libraries/network-protocol/browser/sender.md) so cross-runtime communication is symmetric.

---

Canonical page: https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/sender/
This file: https://www.hyperfrontend.dev/docs/libraries/network-protocol/node/sender.md
Documentation index: https://www.hyperfrontend.dev/llms.txt
