Trait ConnectionHandler

Source
pub trait ConnectionHandler: Send + 'static {
    // Required method
    fn message_received(&mut self, message: PublishedMessage);

    // Provided methods
    fn connected(&mut self) { ... }
    fn disconnected(&mut self, _frame: Option<CloseFrame<'static>>) { ... }
    fn inbound_error(&mut self, _error: ClientError) { ... }
    fn outbound_error(&mut self, _error: ClientError) { ... }
}
Expand description

Handlers for the RPC stream events.

Required Methods§

Source

fn message_received(&mut self, message: PublishedMessage)

Called when a message is received from the Relay.

Provided Methods§

Source

fn connected(&mut self)

Called when a connection to the Relay is established.

Source

fn disconnected(&mut self, _frame: Option<CloseFrame<'static>>)

Called when the Relay connection is closed.

Source

fn inbound_error(&mut self, _error: ClientError)

Called when an inbound error occurs, such as data deserialization failure, or an unknown response message ID.

Source

fn outbound_error(&mut self, _error: ClientError)

Called when an outbound error occurs, i.e. failed to write to the websocket stream.

Implementors§