Skip to main content

ProtocolHandler

Trait ProtocolHandler 

Source
pub trait ProtocolHandler: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn run<'life0, 'async_trait>(
        &'life0 self,
        registry: Arc<dyn PublishRegistry>,
        shutdown: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Low-level protocol handler that accepts connections and maps them to stream identities. Each concrete protocol implementation provides this.

Unlike stream-center’s original ProtocolHandler, run receives a PublishRegistry trait object rather than reaching for a concrete ApplicationRegistry, so a handler is reusable against any engine — or a host’s own bus implementation.

Required Methods§

Source

fn name(&self) -> &'static str

Human-readable name (e.g. "rtmp", "hls").

Source

fn run<'life0, 'async_trait>( &'life0 self, registry: Arc<dyn PublishRegistry>, shutdown: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start accepting connections. Implementations should run until the provided shutdown token is cancelled, resolving incoming connections to a StreamKey and forwarding frames through registry.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§