pub struct ServerSession { /* private fields */ }Expand description
The sans-IO RTMP publish ingest server session (see the module doc).
No sockets or clocks live here: drive it entirely by feeding inbound
bytes to handle_data.
Implementations§
Source§impl ServerSession
impl ServerSession
Sourcepub fn new(config: ServerConfig) -> Self
pub fn new(config: ServerConfig) -> Self
A new session with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
A new session using ServerConfig::default.
Sourcepub fn handle_data(
&mut self,
input: &[u8],
) -> Result<(Vec<u8>, Vec<ServerEvent>), RtmpError>
pub fn handle_data( &mut self, input: &[u8], ) -> Result<(Vec<u8>, Vec<ServerEvent>), RtmpError>
Feed inbound bytes to the session. Returns (bytes to write back, events produced).
Buffers partial handshake input and partial chunks across calls — callers just need to forward whatever bytes arrive off the wire, in order, one call per read.
§Errors
RtmpError on malformed handshake/chunk/AMF0 input, or a command
used out of order (e.g. publish before connect). Never panics on
truncated or garbage input. On Err the session should be considered
unrecoverable/torn down: internal state may have partially advanced
past the offending input, so the caller must not keep driving it.