connected_hook

Attribute Macro connected_hook 

Source
#[connected_hook]
Expand description

Registers a function as a connected hook.

This attribute macro registers the decorated function to be executed when a new client connection is established. This macro requires the #[hyperlane(server: Server)] macro to be used to define the server instance.

§Note

If an order parameter is not specified, the hook will have a higher priority than hooks with a specified order.

§Usage

use hyperlane::*;
use hyperlane_macros::*;

#[connected_hook]
#[connected_hook(1)]
#[connected_hook("2")]
async fn handle_new_connection(ctx: Context) {
    // Connection handling logic
}

§Dependencies

This macro depends on the #[hyperlane(server: Server)] macro to define the server instance.