pub async fn event_loop(mut self) -> Result<(), WampError> {
        let mut ctl_channel = self.ctl_channel.take().unwrap();

        // Notify the client that we are now running the event loop
        let _ = self.core_res.send(Ok(()));
        loop {
            match select! {
                // Peer sent us a message
                msg = self.recv() => {
                    match msg {
                        Err(e) => {
                            /* The WAMP spec leaves it up to the server implementation
                            to decide whether to close a connection or not after a
                            GOODBYE message (leaving the realm). If we have left the realm,
                            treat a recv() error as expected */
                            if self.valid_session {
                                error!("Failed to recv : {:?}", e);
                                let _ = self.core_res.send(Err(e));
                            }

                            break;
                        },
                        Ok(m) => self.handle_peer_msg(m).await,
                    }
                },
                // client wants to send a message
                req = ctl_channel.recv() => {
                    let req = match req {
                        Some(r) => r,
                        None => {
                            let _ = self.core_res.send(Err(WampError::ClientDied));
                            break;
                        }
                    };
                    self.handle_local_request(req).await
                }
            } {
                Status::Shutdown => {
                    let _ = self.core_res.send(Ok(()));
                    break;
                }
                Status::Ok => {}
            }
        }
        debug!("Event loop shutting down !");

        self.shutdown().await;

        Ok(())
    }
/// Event loop that handles outbound/inboud events
Event loop that handles outbound/inboud events
Event loop that handles outbound / inboud events
pub async fn event_loop(mut self) -> Result<(), WampError> {
        let mut ctl_channel = self.ctl_channel.take().unwrap();
        // Notify the client that we are now running the event loop
        let _ = self.core_res.send(Ok(()));
        loop {
            match select! {
                // Peer sent us a message
                msg = self.recv() => {
                    match msg {
                        Err(e) => {
                            /* The WAMP spec leaves it up to the server implementation
                            to decide whether to close a connection or not after a
                            GOODBYE message (leaving the realm). If we have left the realm,
                            treat a recv() error as expected */
                            if self.valid_session {
                                error!("Failed to recv : {:?}", e);
                                let _ = self.core_res.send(Err(e));
                            }
                            break;
                        },
                        Ok(m) => self.handle_peer_msg(m).await,
                    }
                },
                // client wants to send a message
                req = ctl_channel.recv() => {
                    let req = match req {
                        Some(r) => r,
                        None => {
                            let _ = self.core_res.send(Err(WampError::ClientDied));
                            break;
                        }
                    };
                    self.handle_local_request(req).await
                }
            } {
                Status::Shutdown => {
                    let _ = self.core_res.send(Ok(()));
                    break;
                }
                Status::Ok => {}
            }
        }
        debug!("Event loop shutting down !");
        self.shutdown().await;
        Ok(())
    }
pub async fn event_loop ( mut self ) -> Result < ( ) , WampError > { let mut ctl_channel = self . ctl_channel . take ( ) . unwrap ( ) ; // Notify the client that we are now running the event loop let _ = self . core_res . send ( Ok ( ( ) ) ) ; loop { match select ! { // Peer sent us a message msg self recv ( ) { match msg { Err ( e ) { /* The WAMP spec leaves it up to the server implementation
                            to decide whether to close a connection or not after a
                            GOODBYE message (leaving the realm). If we have left the realm,
                            treat a recv() error as expected */ if self valid_session { error ( " " e ) let self core_res send ( Err ( e ) ) } break } Ok ( m ) self handle_peer_msg ( m ) await } } // client wants to send a message req ctl_channel recv ( ) { let req match req { Some ( r ) r None { let self core_res send ( Err ( WampError ClientDied ) ) break } } self handle_local_request ( req ) await } } { Status :: Shutdown => { let _ = self . core_res . send ( Ok ( ( ) ) ) ; break ; } Status :: Ok => { } } } debug ! ( " " ) ; self . shutdown ( ) . await ; Ok ( ( ) ) }
Event loop that handles outbound/inboud events
Event loop that handles outbound / inboud events
mut self