Skip to content

Commit 1f05e70

Browse files
authored
chore(bench/heaptrack): add middleware to bench
1 parent 15ff555 commit 1f05e70

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

e2e/heaptrack/src/main.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use hyper::server::conn::http1;
22
use hyper_util::rt::TokioIo;
3-
use socketioxide::{extract::SocketRef, SocketIo};
3+
use socketioxide::{extract::SocketRef, handler::ConnectHandler, SocketIo};
44
use std::{net::SocketAddr, time::Duration};
55
use tokio::net::TcpListener;
66

@@ -10,11 +10,15 @@ fn on_connect(socket: SocketRef) {
1010
});
1111
}
1212

13+
fn middleware() -> Result<(), std::convert::Infallible> {
14+
Ok(())
15+
}
16+
1317
#[tokio::main]
1418
async fn main() -> Result<(), Box<dyn std::error::Error>> {
1519
let (svc, io) = SocketIo::new_svc();
1620

17-
io.ns("/", on_connect);
21+
io.ns("/", on_connect.with(middleware).with(middleware));
1822

1923
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
2024
let listener = TcpListener::bind(addr).await?;

0 commit comments

Comments
 (0)