pub async fn start_stream(
api_endpoint: String,
name: String,
token: String,
resource_types: Vec<String>,
) -> Result<ResourceStream, Error>
Expand description
Makes an http connection to the rdsys backend api endpoint and returns a ResourceStream if successful
§Examples
ⓘ
use rdsys_backend::start_stream;
let endpoint = String::from("http://127.0.0.1:7100/resource-stream");
let name = String::from("https");
let token = String::from("HttpsApiTokenPlaceholder");
let types = vec![String::from("obfs2"), String::from("scramblesuit")];
let stream = start_stream(endpoint, name, token, types).await.unwrap();
loop {
match Pin::new(&mut stream).poll_next(&mut cx) {
Poll::Ready(Some(diff)) => println!("Received diff: {:?}", diff),
Poll::Ready(None) => break,
Poll::Pending => continue,
}
}