SUBSCRIBE_TRACKS requests subscriptions: the publisher sends PUBLISH messages for tracks within matching namespaces, excluding tracks published by the subscriber.
A SUBSCRIBE_TRACKS with zero Track Namespace fields indicates the subscriber is requesting a Subscription for all Tracks from the publisher.
SUBSCRIBE_TRACKS is not required for a publisher to send PUBLISH messages to a subscriber. It is useful, for example, when the subscriber does not know the exact names of the tracks it wants, or when those tracks will be published.
The publisher will respond with SUBSCRIBE_TRACKS_OK or SUBSCRIBE_TRACKS_ERROR
on the response half of the stream. If the subscriber receives any message
other than a SUBSCRIBE_TRACKS_OK or a SUBSCRIBE_TRACKS_ERROR as the first
message on the response half of the stream, then it MUST close the session with
UNEXPECTED_MESSAGE. If the SUBSCRIBE_TRACKS is successful, the publisher will
send PUBLISH messages on new bidirectional streams for tracks matching the
Namespace Prefix. If it is an error, the stream will be closed via FIN after
SUBSCRIBE_TRACKS_ERROR is sent.
Each PUBLISH sent as a result of a SUBSCRIBE_TRACKS carries the SUBSCRIBE_TRACKS_ID parameter (Section 9.19.21). If a Track matches more than one SUBSCRIBE_TRACKS, the publisher sends a PUBLISH for each.
The publisher MUST ensure the subscriber is authorized to perform this namespace subscription.
A SUBSCRIBE_TRACKS is cancelled as described in Section 6.4.2.3. Cancelling a SUBSCRIBE_TRACKS has no effect on existing subscriptions. Cancelling SUBSCRIBE_TRACKS does not prohibit original publishers from sending further PUBLISH messages, but relays MUST NOT send any further PUBLISH messages to a client without knowing the client is interested in and authorized to receive the content.
3.6.1. Filtering SUBSCRIBE_TRACKS
Range Filters Section 3.3.2 can be used in SUBSCRIBE_TRACKS to filter Tracks in a namespace using the Track Property Filter. Objects published in the resulting Subscriptions can be filtered by any Range Filter.
3.6.2. Parameters on SUBSCRIBE_TRACKS
The parameters that can appear in SUBSCRIBE_TRACKS are listed in Section 9.17. AUTHORIZATION_TOKEN and TRACK_PROPERTY_FILTER apply to the SUBSCRIBE_TRACKS itself. The publisher uses the others as the initial Subscription parameters when a PUBLISH is sent as a result of SUBSCRIBE_TRACKS, and includes those in the PUBLISH. When a Parameter is omitted from the SUBSCRIBE_TRACKS and resulting PUBLISH, the Subscription uses the default value. Parameters that only apply to a SUBSCRIBE for a single Track, such as RENDEZVOUS_TIMEOUT and NEW_GROUP_REQUEST, cannot appear in SUBSCRIBE_TRACKS.
To join Tracks initiated via the resulting PUBLISHes, the subscriber can specify a Location Filter and optionally include FILL_PARAMETERS in the SUBSCRIBE_TRACKS, or in a REQUEST_UPDATE following PUBLISH_OK, as described in Section 3.5.
3.6.3. Skipped Tracks
If a Subscription cannot be created because there are no available bidirectional streams or any other reason, the Publisher sends a PUBLISH_SKIPPED message on the SUBSCRIBE_TRACKS response stream to indicate the Full Track Name of the Subscription that was not created. The Publisher MUST NOT send a PUBLISH for a Track for a given SUBSCRIBE_TRACKS after PUBLISH_SKIPPED has been sent, scoped to a single PUBLISH. If, for example, the publisher disconnects from a relay and later reconnects and sends a new PUBLISH, the relay MAY send the new PUBLISH downstream. If desired, the subscriber can issue a SUBSCRIBE to establish a subscription to that track.