UDXMultiplexer class

A class that demultiplexes incoming UDX packets to the correct UDPSocket.

The UDXMultiplexer listens on a single RawDatagramSocket and forwards packets to the appropriate UDPSocket instance based on their destination Connection ID (CID).

Constructors

UDXMultiplexer(RawDatagramSocket socket, {UdxMetricsObserver? metricsObserver})

Properties

connections → Stream<UDPSocket>
A stream of incoming UDX sockets.
no setter
hashCode → int
The hash code for this object.
no setterinherited
metricsObserver → UdxMetricsObserver?
Optional metrics observer to be passed to all created sockets
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
socket → RawDatagramSocket
The underlying UDP socket that this multiplexer listens on.
final
socketsByCid → Map<ConnectionId, UDPSocket>
A map of active connections, keyed by their local Connection ID.
final
socketsByPeer → Map<String, UDPSocket>
final

Methods

addSocket(UDPSocket socket) → void
Registers an existing socket with this multiplexer. Used for connection migration.
close() → void
Closes the multiplexer and all associated sockets.
createSocket(UDX udx, String host, int port, {ConnectionId? localCid, ConnectionId? remoteCid, bool isServer = false}) → UDPSocket
Creates or retrieves a UDPSocket for a given peer.
getSocketsForTest() → Map<ConnectionId, UDPSocket>
handleIncomingDatagramForTest(Uint8List data, InternetAddress address, int port) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerResetToken(ConnectionId cid, StatelessResetToken token) → void
Registers a reset token for a connection. This allows the multiplexer to validate incoming stateless resets.
removeSocket(ConnectionId localCid) → void
Removes a socket from the multiplexer's management.
send(Uint8List data, InternetAddress address, int port) → void
Sends a datagram to the specified address and port.
sendStatelessReset(InternetAddress address, int port, ConnectionId connectionId) → void
Sends a stateless reset packet to a peer.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited