@hyperfrontend/network-protocol/browser/sender

sender

Browser-side outbound packet sender with serialization and encryption pre-wired.

createSender builds a Sender from a SendFn transport callback (typically target.postMessage, a WebSocket.send, or a Worker.postMessage) and the protocol-specific encryption pipeline. The returned sender exposes the OutboundQueue / OutboundQueues interface so callers can enqueue messages without thinking about packet construction; serialization, encryption, and obfuscation happen inside the queue before the wire callback fires. Pair with /browser/receiver on the other end and a protocol from /browser/v1 or /browser/v2.

API Reference

Interfaces

§interface

OutboundQueue

Represents an outbound processing queue with measurable size

Properties

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

OutboundQueues

Collection of outbound processing queues

Properties

§readonly encryptionQueue:OutboundQueue
Queue for packets awaiting encryption
§readonly obfuscationQueue:OutboundQueue
Queue for packets awaiting obfuscation
§readonly serializationQueue:OutboundQueue
Queue for packets awaiting serialization
§interface

Sender

Sender interface for processing outbound packets

Properties

§readonly encryptionQueue:OutboundQueue
Queue for packets awaiting encryption
§readonly obfuscationQueue:OutboundQueue
Queue for packets awaiting obfuscation
§readonly resume:() => void
Resumes packet processing
§readonly send:SendFn<T>
Sends data from origin to target
§readonly serializationQueue:OutboundQueue
Queue for packets awaiting serialization
§readonly stop:() => void
Pauses packet processing

Types

§type

CreateSender

Factory function type for creating a Sender instance
type CreateSender = (label: string, sender: SendPacketFn, logger: Logger, packetEncryption: PacketEncryption<T>, packetObfuscation: PacketObfuscation) => Sender<T>
§type

SenderFactory

Alias for CreateSender factory type
type SenderFactory = CreateSender
§type

SendFn

Function to send data from an origin to a target
type SendFn = (origin: string, target: string, data: Data<T>) => void
§type

SendPacketFn

Callback invoked to transmit raw packet bytes
type SendPacketFn = (packet: Uint8Array) => void

Variables

§type

createSender