pub async fn leave_realm(&mut self) -> Result<(), WampError> {
        // Make sure we are still connected to a server
        if !self.is_connected() {
            return Err(From::from(
                "The client is currently not connected".to_string(),
            ));
        }

        // Nothing to do if not currently in a session
        if self.session_id.take().is_none() {
            return Ok(());
        }

        // Send the request
        let (res, result) = oneshot::channel();
        if let Err(e) = self.ctl_channel.send(Request::Leave { res }) {
            return Err(From::from(format!(
                "Core never received our request : {}",
                e
            )));
        }

        // Wait for the result
        match result.await {
            Ok(r) => r?,
            Err(e) => {
                return Err(From::from(format!(
                    "Core never returned a response : {}",
                    e
                )))
            }
        };

        Ok(())
    }
/// Leaves the current realm and terminates the session with the server
Leaves the current realm and terminates the session with the server
Leaves the current realm and terminates the session with the server
pub async fn leave_realm(&mut self) -> Result<(), WampError> {
        // Make sure we are still connected to a server
        if !self.is_connected() {
            return Err(From::from(
                "The client is currently not connected".to_string(),
            ));
        }
        // Nothing to do if not currently in a session
        if self.session_id.take().is_none() {
            return Ok(());
        }
        // Send the request
        let (res, result) = oneshot::channel();
        if let Err(e) = self.ctl_channel.send(Request::Leave { res }) {
            return Err(From::from(format!(
                "Core never received our request : {}",
                e
            )));
        }
        // Wait for the result
        match result.await {
            Ok(r) => r?,
            Err(e) => {
                return Err(From::from(format!(
                    "Core never returned a response : {}",
                    e
                )))
            }
        };
        Ok(())
    }
pub async fn leave_realm ( & mut self ) -> Result < ( ) , WampError > { // Make sure we are still connected to a server if ! self . is_connected ( ) { return Err ( From :: from ( " " . to_string ( ) , ) ) ; } // Nothing to do if not currently in a session if self . session_id . take ( ) . is_none ( ) { return Ok ( ( ) ) ; } // Send the request let ( res , result ) = oneshot :: channel ( ) ; if let Err ( e ) = self . ctl_channel . send ( Request :: Leave { res } ) { return Err ( From :: from ( format ! ( " " e ) ) ) ; } // Wait for the result match result . await { Ok ( r ) => r ? , Err ( e ) => { return Err ( From :: from ( format ! ( " " e ) ) ) } } ; Ok ( ( ) ) }
Leaves the current realm and terminates the session with the server
Leaves the current realm and terminates the session with the server
&mut self