pub struct ChannelEventHandler { /* private fields */ }Expand description
Registers channel-wide listeners. Obtain one with
Channel::events.
Implementations§
Source§impl ChannelEventHandler
impl ChannelEventHandler
Sourcepub fn on_state_change(
&self,
listener: impl Fn(ChannelState) + Send + Sync + 'static,
) -> Registration
pub fn on_state_change( &self, listener: impl Fn(ChannelState) + Send + Sync + 'static, ) -> Registration
Registers a listener for every state transition.
Sourcepub fn on_recovery(
&self,
listener: impl Fn(&RecoveryEvent) + Send + Sync + 'static,
) -> Registration
pub fn on_recovery( &self, listener: impl Fn(&RecoveryEvent) + Send + Sync + 'static, ) -> Registration
Registers a listener for every successful reconnect.
Sourcepub fn on_notice(
&self,
listener: impl Fn(&ServerNotice) + Send + Sync + 'static,
) -> Registration
pub fn on_notice( &self, listener: impl Fn(&ServerNotice) + Send + Sync + 'static, ) -> Registration
Registers a listener for the server’s raw notices.
Sourcepub fn on_error(
&self,
listener: impl Fn(&CelerisError) + Send + Sync + 'static,
) -> Registration
pub fn on_error( &self, listener: impl Fn(&CelerisError) + Send + Sync + 'static, ) -> Registration
Registers a listener for failures that no caller waits for: a
CelerisError::Server that the server sent, or an SDK error such as
an undecodable message, a failed reconnect, or a listener that panicked.
Sourcepub fn on_message(
&self,
listener: impl Fn(&[u8], &MessageMetadata) + Send + Sync + 'static,
) -> Registration
pub fn on_message( &self, listener: impl Fn(&[u8], &MessageMetadata) + Send + Sync + 'static, ) -> Registration
Registers a listener for every delivery from any segment that the connection is a member of, also when that segment has no listeners of its own. For each delivery it runs after the segment’s listeners (MSG-02).
Removing it removes only this listener: the other listeners and the subscriptions do not change, and nothing is sent to the server.