| Crates.io | http-rs |
| lib.rs | http-rs |
| version | 0.1.3 |
| created_at | 2020-06-17 02:04:21.035715+00 |
| updated_at | 2020-06-17 21:58:08.999598+00 |
| description | Designed for https://github.com/euvoor/hawk |
| homepage | https://github.com/euvoor/hawk |
| repository | https://github.com/euvoor/hawk/tree/master/daemon/http |
| max_upload_size | |
| id | 254801 |
| size | 12,158 |
Designed for HAWK
use tokio::net::TcpListener;
use http_rs::Http;
use websocket_rs::{ Websocket, Opcode };
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut listener = TcpListener::bind("127.0.0.1:8080").await?;
println!("Listening for websocket connections on 127.0.0.1:8080");
while let Ok((stream, addr)) = listener.accept().await {
tokio::spawn(async move {
println!("New connection from {:?}", addr);
let mut http = Http::new(stream);
if let Some(req) = http.next().await {
println!("{:?}", req);
}
});
}
Ok(())
}