Engineioxide does the heavy lifting for Socketioxide, a SocketIO server implementation in Rust which integrates with the tower stack.

It can also be used as a standalone server for EngineIO clients.

Engine.IO example echo implementation with Axum :

```rust

[derive(Clone)]

struct MyHandler;

[engineioxide::async_trait]

impl EngineIoHandler for MyHandler { type Data = ();

fn on_connect(self: Arc<Self>, socket: &Socket<Self>) {
    println!("socket connect {}", socket.sid);
}
fn on_disconnect(self: Arc<Self>, socket: &Socket<Self>) {
    println!("socket disconnect {}", socket.sid);
}

async fn on_message(self: Arc<Self>, msg: String, socket: &Socket<Self>) {
    println!("Ping pong message {:?}", msg);
    socket.emit(msg).ok();
}

async fn on_binary(self: Arc<Self>, data: Vec<u8>, socket: &Socket<Self>) {
    println!("Ping pong binary message {:?}", data);
    socket.emit_binary(data).ok();
}

}

[tokio::main]

async fn main() -> Result<(), Box> { let subscriber = FmtSubscriber::builder().finish(); tracing::subscriber::setglobaldefault(subscriber)?;

info!("Starting server");
let app = axum::Router::new()
    .route("/", get(|| async { "Hello, World!" }))
    .layer(EngineIoLayer::new(MyHandler));

Server::bind(&"0.0.0.0:3000".parse().unwrap())
    .serve(app.into_make_service())
    .await?;

Ok(())

} ```