pub struct RtmpServer { /* private fields */ }Expand description
Listening socket for incoming RTMP publishers.
Implementations§
Source§impl RtmpServer
impl RtmpServer
pub fn bind(addr: impl ToSocketAddrs) -> Result<Self>
pub fn local_addr(&self) -> Result<SocketAddr>
Sourcepub fn set_capabilities(&mut self, caps: ConnectCapabilities) -> &mut Self
pub fn set_capabilities(&mut self, caps: ConnectCapabilities) -> &mut Self
Advertise the given Enhanced RTMP v1+v2 capabilities to every
subsequent accept-ed publisher. The block is appended to the
_result(connect) info object alongside the standard
NetConnection.Connect.Success status; legacy publishers ignore
the unknown properties and stay on the pre-2023 path. Pre-2023
is also what set_capabilities(ConnectCapabilities::default())
(or never calling this method) wires up.
Sourcepub fn capabilities(&self) -> &ConnectCapabilities
pub fn capabilities(&self) -> &ConnectCapabilities
Capability block this server currently advertises.
Sourcepub fn accept(&self) -> Result<PublishRequest>
pub fn accept(&self) -> Result<PublishRequest>
Accept one connection, run the handshake + connect + publish setup, and return the first point where the consumer gets to decide whether to take the stream.
Sourcepub fn serve<F>(&self, handler: F) -> Result<()>
pub fn serve<F>(&self, handler: F) -> Result<()>
Loop forever, spawning one thread per accepted publisher. The
handler is called after accept() — i.e. it receives a
PublishRequest it can accept / reject the same way the
single-client path does.
The handler should do its own work on the returned
RtmpSession (call next_packet until it returns None,
then drop). Panics in the handler are caught by the per-thread
panic boundary.