pub enum ConnectionEvent<const CONFIG: u64, LocalMessages: ReactiveMessagingSerializer<LocalMessages> + Send + Sync + PartialEq + Debug + 'static, SenderChannel: FullDuplexUniChannel<ItemType = LocalMessages, DerivedItemType = LocalMessages> + Send + Sync> {
PeerConnected {
peer: Arc<Peer<CONFIG, LocalMessages, SenderChannel>>,
},
PeerDisconnected {
peer: Arc<Peer<CONFIG, LocalMessages, SenderChannel>>,
stream_stats: Arc<dyn StreamExecutorStats + Sync + Send>,
},
ApplicationShutdown {
timeout_ms: u32,
},
}Expand description
The internal events a reactive processor (for a server or client) shares with the user code.
The user code may use those events to maintain a list of connected clients, be notified of stop/close/quit requests, init/de-init sessions, etc.
Note that the Peer objects received in those events may be used, at any time, to send messages to the clients – like “Shutting down. Goodbye”.
IMPLEMENTATION NOTE: GAT traits (to reduce the number of generic parameters) couldn’t be used here – even after applying this compiler bug workaround https://github.com/rust-lang/rust/issues/102211#issuecomment-1513931928
– the “error: implementation of std::marker::Send is not general enough” bug kept on popping up in user provided closures that called other async functions.
Variants§
PeerConnected
PeerDisconnected
Fields
stream_stats: Arc<dyn StreamExecutorStats + Sync + Send>