pub trait SessionHandler {
// Required methods
fn on_publish(
&mut self,
stream_id: u32,
app_name: &str,
stream_name: &str,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send;
fn on_unpublish(
&mut self,
stream_id: u32,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send;
fn on_data(
&mut self,
stream_id: u32,
data: SessionData,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send;
// Provided methods
fn on_unknown_message(
&mut self,
stream_id: u32,
message: UnknownMessage,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send { ... }
fn on_unknown_command(
&mut self,
stream_id: u32,
command: UnknownCommand<'_>,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send { ... }
}
Expand description
Handler for session events.
Required Methods§
Sourcefn on_publish(
&mut self,
stream_id: u32,
app_name: &str,
stream_name: &str,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send
fn on_publish( &mut self, stream_id: u32, app_name: &str, stream_name: &str, ) -> impl Future<Output = Result<(), ServerSessionError>> + Send
Called when a stream is published.
Sourcefn on_unpublish(
&mut self,
stream_id: u32,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send
fn on_unpublish( &mut self, stream_id: u32, ) -> impl Future<Output = Result<(), ServerSessionError>> + Send
Called when a stream is unpublished.
Sourcefn on_data(
&mut self,
stream_id: u32,
data: SessionData,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send
fn on_data( &mut self, stream_id: u32, data: SessionData, ) -> impl Future<Output = Result<(), ServerSessionError>> + Send
Called when data is received.
Provided Methods§
Sourcefn on_unknown_message(
&mut self,
stream_id: u32,
message: UnknownMessage,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send
fn on_unknown_message( &mut self, stream_id: u32, message: UnknownMessage, ) -> impl Future<Output = Result<(), ServerSessionError>> + Send
Called when an unknown/undefined message is received.
Sourcefn on_unknown_command(
&mut self,
stream_id: u32,
command: UnknownCommand<'_>,
) -> impl Future<Output = Result<(), ServerSessionError>> + Send
fn on_unknown_command( &mut self, stream_id: u32, command: UnknownCommand<'_>, ) -> impl Future<Output = Result<(), ServerSessionError>> + Send
Called when an unknown/undefined command is received.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.