@hyperfrontend/network-protocol/node/receiver

receiver

Node.js-side inbound packet receiver with deserialization and decryption pre-wired.

createReceiver builds a Receiver from a ReceiveFn transport hook (typically a TCP socket data event, a process.on('message', …) IPC handler, or a WebSocket message handler) and the protocol-specific decryption pipeline. The returned receiver exposes the InboundQueue / InboundQueues interface so application code can subscribe to deserialized application messages without thinking about packet teardown; deobfuscation, decryption, and deserialization happen inside the queue before the application handler fires. Pair with /node/sender on the other end and a protocol from /node/v1 or /node/v2. Function signatures match /browser/receiver so cross-runtime communication is symmetric.

API Reference

Interfaces

§interface

InboundQueue

Represents a queue with a measurable size

Properties

§readonly size:number
Number of items in the queue
§interface

InboundQueues

Collection of inbound processing queues

Properties

§readonly decryptionQueue:InboundQueue
Queue for packets awaiting decryption
§readonly deobfuscationQueue:InboundQueue
Queue for packets awaiting deobfuscation
§readonly deserializationQueue:InboundQueue
Queue for packets awaiting deserialization
§interface

Receiver

Receiver interface for processing inbound packets

Properties

§readonly decryptionQueue:InboundQueue
Queue for packets awaiting decryption
§readonly deobfuscationQueue:InboundQueue
Queue for packets awaiting deobfuscation
§readonly deserializationQueue:InboundQueue
Queue for packets awaiting deserialization
§readonly receive:ReceiveFn
Processes an incoming raw packet
§readonly resume:() => void
Resumes packet processing
§readonly stop:() => void
Pauses packet processing

Types

§type

CreateReceiver

Factory function type for creating a Receiver instance
type CreateReceiver = (label: string, receiver: ReceivePacketFn<T>, logger: Logger, packetDeobfuscation: PacketDeobfuscation, packetDecryption: PacketDecryption<T>) => Receiver
§type

ReceiveFn

Function to receive raw packet data
type ReceiveFn = (packet: Uint8Array) => void
§type

ReceivePacketFn

Callback invoked when a decrypted packet is received
type ReceivePacketFn = (packet: UnencryptedPacket<T>) => void
§type

ReceiverFactory

Alias for CreateReceiver factory type
type ReceiverFactory = CreateReceiver

Variables

§type

createReceiver