Skip to content

How to listen a stream #29

Description

@milobluebell

I am beginner of Rust language, So i wanna know how to listen a stream from conn, i do resolve request/response traffic,but sometimes there will be server side pushed stream traffic, how to deal that?

Example: In game Squad, players chat in server or establishing one team will trigger a pushing event message through the pipeline of Rcon. Conn will receive a message for that

#[tokio::main]
async fn main() -> Result<(), Error> {
    let config: config::Config = config::Config::new("110.42.9.143", 21149, "LiT5B6nJmeeUUpdT2U");

    let mut conn = <Connection<AsyncStdStream>>
        ::builder()
        .connect(&config.address, &config.password).await?;

    // TODO: I noticed that io is a private member on Connection, so...
    HereINeedASnippets_ToListenServerSidePushedMessages()   <==================== What should i fill here

    let resp = conn.cmd("ListPlayers").await?;
    println!("{}", resp);

    Ok(())
}

Ty!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions