pub struct SessionEventLoop<T>{ /* private fields */ }Expand description
The session event loop drives the client. It must be polled for anything to happen at all.
Implementations§
Source§impl<T> SessionEventLoop<T>
impl<T> SessionEventLoop<T>
Sourcepub async fn run(self) -> StatusCode
pub async fn run(self) -> StatusCode
Convenience method for running the session event loop until completion, this method will return once the session is closed manually, or after it fails to reconnect.
§Returns
StatusCode- Status code indicating how the session terminated.
Sourcepub fn spawn(self) -> JoinHandle<StatusCode>
pub fn spawn(self) -> JoinHandle<StatusCode>
Convenience method for running the session event loop until completion on a tokio task.
This method will return a JoinHandle that will terminate
once the session is closed manually, or after it fails to reconnect.
§Returns
JoinHandle<StatusCode>- Handle to a tokio task wrapping the event loop.
Sourcepub fn enter(self) -> impl Stream<Item = Result<SessionPollResult, StatusCode>>
pub fn enter(self) -> impl Stream<Item = Result<SessionPollResult, StatusCode>>
Start the event loop, returning a stream that must be polled until it is closed.
The stream will return None when the transport is closed manually, or
Some(Err(StatusCode)) when the stream fails to reconnect after a loss of connection.
It yields events from normal session operation, which can be used to take specific actions based on changes to the session state.