Skip to content

Type Alias: MOQtailRequest ​

MOQtailRequest = PublishRequest | PublishNamespaceRequest | SubscribeNamespaceRequest | FetchRequest | SubscribeRequest | TrackStatusRequest

Discriminated union of every in‑flight MOQ‑tail control request tracked by the MOQtailClient.

Each concrete request type encapsulates the original control message plus coordination primitives (e.g. a Promise facade / stream controller) that resolve when a terminal protocol response (OK / ERROR / CANCEL) is received.

Used internally in maps like MOQtailClient.requests to look up state by request id without needing multiple heterogeneous collections.

Variants:

Example ​

Looking up a request by id

ts
function isActive(requests: Map<bigint, MOQtailRequest>, id: bigint) {
  const req = requests.get(id)
  if (!req) return false
  // Narrow by instanceof, e.g. FetchRequest
  if (req instanceof FetchRequest) {
    console.log('Fetch still pending for', req.message.requestId)
  }
  return true
}