Skip to main content

ArclyGateway

Trait ArclyGateway 

Source
pub trait ArclyGateway:
    Send
    + Sync
    + 'static {
    // Provided methods
    fn on_connect(&self, client: WsClient) -> impl Future<Output = ()> + Send { ... }
    fn on_disconnect(&self, client: WsClient) -> impl Future<Output = ()> + Send { ... }
}
Expand description

Connection lifecycle for a real-time gateway.

Implement on your gateway struct. Both hooks default to no-ops, so override only what you need. Handlers for individual events are declared with #[Subscribe("event::name")] inside the #[Gateway(...)] impl block.

Provided Methods§

Source

fn on_connect(&self, client: WsClient) -> impl Future<Output = ()> + Send

Fired after the socket has upgraded and been registered.

Source

fn on_disconnect(&self, client: WsClient) -> impl Future<Output = ()> + Send

Fired after the socket has closed and just before it is unregistered.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§