Skip to main content

watch_broadcasts

Function watch_broadcasts 

Source
pub async fn watch_broadcasts<H, F>(
    session: &Session,
    prefix: &[impl AsRef<str>],
    options: WatchOptions,
    handler: H,
) -> Result<()>
where H: Fn(RemoteBroadcast) -> F, F: Future<Output = Result<()>> + Send + 'static,
Expand description

Runs handler on a task for each namespace published under prefix, including those published before the call, except this session’s own. A withdrawal aborts the namespace’s task; publishing it again starts a new one. A handler’s Err is logged.

Returns when the session ends or options.empty_timeout passes, and aborts every task when it returns or is dropped. Fails when the relay refuses the SUBSCRIBE_NAMESPACE.