SrtConnection
Owns one SRT peer connection. connect suspends until a caller connects or a listener accepts a peer. No stream multiplexing or media framing is performed.
scope owns disconnection monitoring; its cancellation closes this connection. Close the connection (for example with use) before leaving that scope normally. After close/failure, this instance can connect again while its scope is active.
Parameters
Owner of connection monitoring; its context must contain a Job.
Default socket configuration, overridden by supported URI query parameters.
Types
Properties
Cold, unbuffered message flow for a single collector. Each collection uses the currently open peer. Completion or cancellation closes that peer. Concurrent readers are rejected without interrupting the existing reader. I/O failures propagate to the collector; no reconnection is automatic.
Reads the native peer state; false while connecting, listening or closed.
Native local address once bound; null before binding or after close. Port zero exposes the allocated port here.
Selected handshake role, or null when closed.
State of the current attempt. CLOSED is the initial state; fast transitions may be conflated.
Functions
Takes a fresh statistics snapshot for the open peer, or returns null if it is not open. If resetInterval is true, starts a new interval after taking the snapshot. The interval is shared by all callers on this peer. Cumulative counters are preserved.
Sends transport bytes as messages of at most 1316 bytes, applying native backpressure. Concurrent calls retain their chunk ordering. Do not mutate data until return. Success means libsrt accepted the bytes, not that the peer has consumed them. Cancelling an active send closes the connection; cancelling a queued sender leaves the active sender intact. Empty arrays produce no messages.