Trait jsonrpsee_core::client::TransportSenderT

source ·
pub trait TransportSenderT: MaybeSend + 'static {
    type Error: Error + Send + Sync;

    // Required method
    fn send<'life0, 'async_trait>(
        &'life0 mut self,
        msg: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn send_ping<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Transport interface to send data asynchronous.

Required Associated Types§

source

type Error: Error + Send + Sync

Error that may occur during sending a message.

Required Methods§

source

fn send<'life0, 'async_trait>( &'life0 mut self, msg: String, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send.

Provided Methods§

source

fn send_ping<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

This is optional because it’s most likely relevant for WebSocket transports only. You should only implement this is your transport supports sending periodic pings.

Send ping frame (opcode of 0x9).

source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

This is optional because it’s most likely relevant for WebSocket transports only. You should only implement this is your transport supports being closed.

Send customized close message.

Implementors§