Session server

This commit is contained in:
2026-02-19 12:58:07 +01:00
parent c3dd874a87
commit c6184363d8
3 changed files with 54 additions and 31 deletions
+5 -9
View File
@@ -66,16 +66,12 @@ impl Method for Data {
let server = SessionServer::bind("127.0.0.1:8080").await?;
loop {
let session = server.accept().await;
server
.session_loop(async |session, addr| {
// This will run on every new client
session
.on::<Data, _>(async |_, req| {
// Response is required
Ok("Hello from server".to_string())
})
.await;
}
Ok(())
}).await;
```
## Protocol