import type { Signal } from "@moq/signals"; import { Announced } from "../announced"; import type { Bandwidth } from "../bandwidth"; import { Broadcast } from "../broadcast"; import * as Path from "../path"; import { type Reader } from "../stream"; import type * as Time from "../time"; import type { Group as GroupMessage } from "./group"; import type { Origin } from "./origin"; import { Version } from "./version"; /** * Options accepted by {@link Subscriber.announced}. */ export interface AnnouncedOptions { /** * If true, skip announcements whose hop chain contains this connection's * own origin id — useful for meshes that reflect announces back. Defaults * to false for backwards compatibility: existing code (notably hang.live) * relies on seeing its own publishes as the signal that a namespace * published successfully. */ ignoreSelf?: boolean; } /** * Handles subscribing to broadcasts and managing their lifecycle. * * @internal */ export declare class Subscriber { #private; readonly version: Version; readonly origin: Origin; /** * Creates a new Subscriber instance. * @param quic - The WebTransport session to use * @param version - The protocol version * @param origin - Origin id shared with the Publisher * @param recvBandwidth - Optional bandwidth producer for PROBE * @param rtt - Optional RTT signal for PROBE * * @internal */ constructor(quic: WebTransport, version: Version, origin: Origin, recvBandwidth?: Bandwidth, rtt?: Signal); /** * Subscribe to broadcast announcements under `prefix`. * * Pass `{ ignoreSelf: true }` to skip announces that have already traversed * this connection's {@link origin}. */ announced(prefix?: Path.Valid, options?: AnnouncedOptions): Announced; /** * Consumes a broadcast from the connection. * * @param name - The name of the broadcast to consume * @returns A Broadcast instance */ consume(path: Path.Valid): Broadcast; /** * Handles a group message. * @param group - The group message * @param stream - The stream to read frames from * * @internal */ runGroup(group: GroupMessage, stream: Reader): Promise; /** * Opens a PROBE bidi stream to receive bandwidth estimates from the publisher. * Returns immediately if recv bandwidth is not supported. * * Probe is best-effort telemetry: a stream-level failure (peer reset, FIN, * missing peer support, transport hiccup) is caught and logged, never * propagated to the connection. On exit the bandwidth/RTT signals are * cleared so consumers see them as stale. * * @internal */ runProbe(): Promise; close(): void; } //# sourceMappingURL=subscriber.d.ts.map