pub async fn new(channel: C, scope: &Scope<'_>) -> Result<Self, ClientError<C::Error>> {
        let mut channel = channel;
        channel
            .send_reliable::<ClientMessage, _>(ClientMessageConnectPack { token: "evoke" }, scope)
            .await?;

        loop {
            match channel.recv::<ServerMessage>(scope) {
                Ok(Some(ServerMessageUnpacked::Connected { step })) => {
                    return Ok(ClientSession {
                        channel,
                        current_step: step,
                        next_update_step: 0,
                    });
                }
                Ok(Some(ServerMessageUnpacked::Updates { .. })) => {}
                Ok(Some(ServerMessageUnpacked::PlayerJoined { .. })) => {
                    return Err(ClientError::UnexpectedMessage)
                }
                Ok(None) => {
                    channel.recv_ready().await?;
                }
                Err(err) => return Err(err.into()),
            }
        }
    }
/// Create new client session via specified channel.
Create new client session via specified channel.
Create new client session via specified channel .
pub async fn new(channel: C, scope: &Scope<'_>) -> Result<Self, ClientError<C::Error>> {
        let mut channel = channel;
        channel
            .send_reliable::<ClientMessage, _>(ClientMessageConnectPack { token: "evoke" }, scope)
            .await?;
        loop {
            match channel.recv::<ServerMessage>(scope) {
                Ok(Some(ServerMessageUnpacked::Connected { step })) => {
                    return Ok(ClientSession {
                        channel,
                        current_step: step,
                        next_update_step: 0,
                    });
                }
                Ok(Some(ServerMessageUnpacked::Updates { .. })) => {}
                Ok(Some(ServerMessageUnpacked::PlayerJoined { .. })) => {
                    return Err(ClientError::UnexpectedMessage)
                }
                Ok(None) => {
                    channel.recv_ready().await?;
                }
                Err(err) => return Err(err.into()),
            }
        }
    }
pub async fn new ( channel : C , scope : & Scope < ' _ > ) -> Result < Self , ClientError < C :: Error > > { let mut channel = channel ; channel . send_reliable :: < ClientMessage , _ > ( ClientMessageConnectPack { token : " " } , scope ) . await ? ; loop { match channel . recv :: < ServerMessage > ( scope ) { Ok ( Some ( ServerMessageUnpacked :: Connected { step } ) ) => { return Ok ( ClientSession { channel , current_step : step , next_update_step : 0 , } ) ; } Ok ( Some ( ServerMessageUnpacked :: Updates { .. } ) ) => { } Ok ( Some ( ServerMessageUnpacked :: PlayerJoined { .. } ) ) => { return Err ( ClientError :: UnexpectedMessage ) } Ok ( None ) => { channel . recv_ready ( ) . await ? ; } Err ( err ) => return Err ( err . into ( ) ) , } } }
Create new client session via specified channel.
Create new client session via specified channel .
channel
C
scope
&Scope<'_>