Skip to content

PATTERN Cited by 1 source

Publish before subscribe

Problem

In a relay-mediated pub/sub system, the first subscription must travel through the relay chain to the publisher before the publisher starts sending. This adds latency for the first viewer — they must wait for the round-trip to the publisher before receiving any data.

Solution

A PUBLISH primitive lets a publisher send a track to a relay proactively, before any viewer requests it. The relay is already receiving the track when the first subscriber connects, eliminating the subscription-to-publisher round-trip from the first viewer's join latency.

Consequences

  • Lower first-viewer latency — data is already flowing at the relay when the first subscriber arrives.
  • Publisher pushes proactively — no reactive "subscriber triggers publisher" dependency for live streams.
  • Trade-off: relay stores data that may never be consumed if no subscribers arrive; appropriate for live-streaming-like workloads where at least one subscriber is expected.

Seen in

Last updated · 606 distilled / 1,847 read