Expand description
A kernel that reacts to new channels created, allowing communication with new clients. Useful for when a server needs to send messages to clients Client Connection Event Handler
This module provides a network kernel that executes custom logic whenever a client establishes a connection. It’s particularly useful for implementing server-side connection handling, authentication, and session initialization.
§Features
- Custom connection handling
- Asynchronous event processing
- Type-safe callback execution
- Session security management
- UDP channel support
- Service discovery integration
§Example:
use citadel_sdk::prelude::*;
use citadel_sdk::prefabs::server::client_connect_listener::ClientConnectListenerKernel;
let kernel = Box::new(ClientConnectListenerKernel::<_, _, StackedRatchet>::new(|conn| async move {
println!("Client connected!");
Ok(())
}));
§Important Notes
- Callbacks must be Send + Sync
- Futures must be Send + Sync
- Handles both TCP and UDP channels
- Automatic security settings handling
§Related Components
NetKernel
: Base trait for network kernelsClientServerRemote
: Client-server communicationCitadelClientServerConnection
: Connection event dataNodeResult
: Network event handling
Structs§
- A kernel that executes a user-provided function each time a client makes a connection