Relay a Track
By relaying media data from a source track to one or more destination tracks by servers, contents are delivered to a wider audience or users. To forward media data, a server subscribes to a source track as a subscriber to upstream and handles one or more downstream subscriptions as a publisher.Overview
Overview
Relay Broadcasts
TrackMux acts as a hub for relaying broadcasts.
Note: Relay Implementation
gomoqt does not provide built-in implementation for relaying broadcasts and tracks because there are many scenarios on relaying and many different implementations. The relay implementation is left to the user.Hop ID and Loop Avoidance
Relay nodes MUST use a unique non-zero hop ID to enable loop avoidance. When creating aTrackMux for a relay, use moqt.NewHopID() to generate a unique identifier:
AcceptAnnounce), it automatically sends an ExcludeHop with the mux’s hop ID to prevent announcement loops. Each Announcement carries a list of hop IDs it has traversed, accessible via Announcement.HopIDs.
0 as the hop ID:
Caching
To enhance UX, consider implementing caching strategies for frequently accessed data or long-lived objects. This can help reduce latency and improve overall performance. Some common caching techniques include:- In-Memory Caching: Store frequently accessed data in memory (RAM) for quick retrieval.
- Distributed Caching: Use a distributed cache system to share cached data across multiple instances.
- Cache Invalidation: Implement strategies to invalidate stale cache entries to ensure data consistency.