pub trait ProtocolExtension: Debug {
// Required methods
fn get_id(&self) -> u8;
fn get_supported_packets(&self) -> &'static [u8] ⓘ;
fn encode(&self) -> Bytes;
fn handle_handshake<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
read: &'life1 mut dyn WebSocketRead,
write: &'life2 LockedWebSocketWrite,
) -> Pin<Box<dyn Future<Output = Result<(), WispError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn handle_packet<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
packet: Bytes,
read: &'life1 mut dyn WebSocketRead,
write: &'life2 LockedWebSocketWrite,
) -> Pin<Box<dyn Future<Output = Result<(), WispError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn box_clone(&self) -> Box<dyn ProtocolExtension + Sync + Send>;
}
Expand description
A Wisp protocol extension.
See the docs.
Required Methods§
Sourcefn get_supported_packets(&self) -> &'static [u8] ⓘ
fn get_supported_packets(&self) -> &'static [u8] ⓘ
Get the protocol extension’s supported packets.
Used to decide whether to call the protocol extension’s packet handler.
Sourcefn handle_handshake<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
read: &'life1 mut dyn WebSocketRead,
write: &'life2 LockedWebSocketWrite,
) -> Pin<Box<dyn Future<Output = Result<(), WispError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_handshake<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
read: &'life1 mut dyn WebSocketRead,
write: &'life2 LockedWebSocketWrite,
) -> Pin<Box<dyn Future<Output = Result<(), WispError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Handle the handshake part of a Wisp connection.
This should be used to send or receive data before any streams are created.
Sourcefn handle_packet<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
packet: Bytes,
read: &'life1 mut dyn WebSocketRead,
write: &'life2 LockedWebSocketWrite,
) -> Pin<Box<dyn Future<Output = Result<(), WispError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_packet<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
packet: Bytes,
read: &'life1 mut dyn WebSocketRead,
write: &'life2 LockedWebSocketWrite,
) -> Pin<Box<dyn Future<Output = Result<(), WispError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Handle receiving a packet.