pub trait Session: Send + Sync {
// Required methods
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn recv<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn client_handshake<'life0, 'async_trait>(
&'life0 self,
hello: Hello,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait { ... }
fn server_handshake<'life0, 'life1, 'life2, 'async_trait, V, R>(
&'life0 self,
validator: &'life1 V,
router: &'life2 R,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
V: 'async_trait + TokenValidator,
R: 'async_trait + Router,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
A higher-level session that speaks the Message protocol over a FramedConnection.
Required Methods§
Provided Methods§
Sourcefn client_handshake<'life0, 'async_trait>(
&'life0 self,
hello: Hello,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
fn client_handshake<'life0, 'async_trait>(
&'life0 self,
hello: Hello,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
Client-side handshake helper.
Sends Hello and waits for HelloOk or HelloErr. Returns bound capability
set on success. Avoids panics; errors map to Error.
Sourcefn server_handshake<'life0, 'life1, 'life2, 'async_trait, V, R>(
&'life0 self,
validator: &'life1 V,
router: &'life2 R,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
V: 'async_trait + TokenValidator,
R: 'async_trait + Router,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn server_handshake<'life0, 'life1, 'life2, 'async_trait, V, R>(
&'life0 self,
validator: &'life1 V,
router: &'life2 R,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
V: 'async_trait + TokenValidator,
R: 'async_trait + Router,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Server-side handshake helper.
Waits for Hello, validates the token, replies with HelloOk/HelloErr, and registers the connection on success.