Socketioxide for Tower-based Rust servers
A socket.io server implementation in Rust that integrates with the Tower ecosystem and the Tokio stack.
At a glance
- What is it?
- Socketioxide is a Rust implementation of the Socket.IO server protocol that fits Axum, Warp, Hyper, Salvo, Viz, and other Tower-based servers. Its handler API supports namespaces, rooms, acknowledgements, binary packets, multiple transports, and distributed adapters.
- Who is it for?
- Socketioxide fits Rust services that already use Tower or Tokio and need Socket.IO semantics without tying the application to one server framework. It is a poor fit when the project requires a non-Tower HTTP stack or documented installation and compatibility procedures beyond those published by the repository.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 4 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 6, 2026, and from our analysis. They are not legal advice.
Star history
- Totodore/socketioxide1,634 ★ · +4
| Repository | 2026-10-16 | 2026-11-06 |
|---|---|---|
| Totodore/socketioxide | 1.6k | 1.6k |
4 Stars in the last 21 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Where Socketioxide fits in a Rust web service
Socketioxide solves the server-side half of Socket.IO for applications written in Rust. It is intended for developers who want Socket.IO namespaces, event callbacks, rooms, acknowledgements, and connection lifecycle handling while retaining Rust's type system and an asynchronous server stack. The repository also describes support for `tower-http` middleware such as CORS, compression, and authorization, which makes the library relevant when HTTP policy needs to coexist with persistent connections.
The integration boundary is Tower rather than a particular web framework. The README names Axum, Warp, Hyper, Salvo, and Viz, and says that other Tower-based middleware can be placed above Socketioxide. That design is useful for teams that already have an HTTP application and want Socket.IO endpoints without rebuilding its networking layer. It also means the application remains responsible for its surrounding server choices, route arrangement, TLS arrangement, and runtime wiring.
Socketioxide is not a general-purpose replacement for every real-time transport. Its documented feature set is centered on Socket.IO and Engine.IO behavior. Projects that only need a lightweight bidirectional channel and do not require the Socket.IO protocol should compare the library with a smaller transport before adopting this dependency.
Socketioxide's handler, namespace, and room model
The central object in the README's examples is `SocketIo`. Calling `SocketIo::new_layer()` produces a layer and an `io` handle. The handle registers namespaces through `io.ns`, while the layer is added to an application router. A namespace callback receives a `SocketRef`, giving the application a reference tied to the connected socket and its namespace.
Event handlers are registered with `socket.on`. Extractors carry event-specific inputs into a callback, including `Data`, `Bin`, and `AckSender`. This permits ordinary and binary payloads to be handled separately, while an acknowledgement request can return data through `AckSender`. The library also exposes room and broadcast operations. In the chat example, `s.broadcast().emit` sends an event to the other sockets associated with the room, and disconnect handlers update application state after a socket leaves.
Per-socket extensions add another layer of state. The chat example stores a `Username` value on `SocketRef`, then retrieves it in event and disconnect callbacks. This is useful for connection-local data, but it also means application state ownership remains explicit. Socketioxide does not turn these examples into a complete authorization, persistence, or session model.
Protocol and transport support in Socketioxide
The README lists polling and WebSocket transports, Common parsing by default, optional Msgpack parsing, binary packets, rooms, dynamic namespaces, and both acknowledgement styles: `emit` with acknowledgement and event callbacks using `AckSender`. Protocol v5 is enabled by default and covers Socket.IO JavaScript clients from version 3.0.0 through the latest release described by the README. Protocol v4, based on Engine.IO v3, is available through the `v4` feature and is associated with older Socket.IO JavaScript clients beginning at version 1.0.3.
That compatibility split affects dependency and client decisions. Enabling protocol v4 is not merely a parser preference. It selects a different supported protocol path, so applications should confirm which Socket.IO client generation they actually need. Similarly, choosing Msgpack instead of the default Common parser changes serialization expectations on both the server and client sides.
The repository reports that it is tested with the official end-to-end test suite. The README does not provide test commands or describe every transport edge case, so this statement should not be read as a claim about any particular application configuration.
Installing and first Axum Socketioxide server
The README links to the crate documentation on `docs.rs` and the `socketioxide` listing on Crates.io, but it does not give an installation command or dependency snippet. Consequently, there is no documented `cargo add` command to reproduce here. The repository's workspace manifest identifies Rust edition `2024`, workspace `rust-version = "1.94.0"`, and `socketioxide` as the core package described by the documentation. A user should first open the linked crate documentation and confirm that the published crate supports the toolchain used by the application.
The shortest documented first use is the Axum echo example. This excerpt creates the Socket.IO layer, registers the same connection function at `/` and `/custom`, and adds the layer to an Axum router:
let (layer, io) = SocketIo::new_layer();
io.ns("/", on_connect);
io.ns("/custom", on_connect);
let app = axum::Router::new()
.route("/", get(|| async { "Hello, World!" }))
.layer(layer);This connects the real-time layer to the application while retaining a normal HTTP route. The README then binds a Tokio TCP listener to `0.0.0.0:3000` and serves the Axum application with `axum::serve`. The complete example also registers a `message` handler that emits `message-back`, and a `message-with-ack` handler that returns both data and binary content through `AckSender`.
Scaling Socketioxide beyond one process
For deployments that span processes, the README points to pluggable adapters for Redis or Valkey, MongoDB, and PostgreSQL. Separate releases listed for `socketioxide-redis` include version `0.4.3`, published on 2026-09-15, and version `0.4.2`, published on 2026-08-24. The core `socketioxide` release listed here is version `0.18.7`, published on 2026-08-24.
The repository separately links Socketioxide-emitter for remote cluster communication. This suggests a distinction between a server library, storage or pub-sub adapters, and a mechanism for emitting from elsewhere in a distributed system. The README does not document adapter configuration, failure behavior, consistency guarantees, or deployment prerequisites, so none of those properties can be inferred from the adapter names alone.
An adapter should therefore be selected from the application's existing infrastructure rather than treated as an automatic benefit. A team using Redis should inspect the `socketioxide-redis` documentation, while MongoDB and PostgreSQL users must do the same for their respective crates. The core repository's `Cargo.toml` does not show those adapters as workspace dependencies, which reinforces that they are separate packages.
Compatibility, maintenance, and project boundaries
The repository is not archived. Its last push was on 2026-10-11, recently, so the available maintenance signal is recent. Recent releases also exist for the core crate and `socketioxide-redis`. This does not establish API stability for a particular application, but it does show that the project is not sitting on an old, archived commit.
The workspace uses Rust edition `2024` and declares a minimum Rust version of `1.94.0`. That is an important adoption constraint because an older stable toolchain will not satisfy the repository's declared requirement. The workspace also enables several Clippy groups, including correctness as `deny`, and groups for complexity, suspicious code, and performance as warnings. Those settings can matter when Socketioxide is incorporated into a repository that shares workspace lint configuration.
The license is MIT. The repository includes a `LICENSE` file and the workspace manifest declares `license = "MIT"`. This identifies the project's stated licensing model, but it is not a substitute for reviewing license obligations in a specific distribution. The main practical upgrade cost is compatibility work across Rust, Socket.IO clients, protocol features, and any separately versioned adapters.
When another real-time server design is preferable
Socketioxide is a reasonable choice when the application already uses Tower and needs Socket.IO's event model. Its namespace registration, room operations, acknowledgements, binary packets, polling, and WebSocket support address a specific server-side protocol rather than a generic streaming API. The availability of framework examples also reduces the amount of adaptation needed for common Rust servers.
A different approach may fit better when the service does not use Tower, does not need Socket.IO compatibility, or wants to avoid maintaining several related crate versions. In that case, selecting a transport and handling its framing, reconnection, room semantics, and binary messages directly would remove Socket.IO-specific compatibility work. The README does not present such an alternative, so the concrete difference is architectural: Socketioxide supplies a Socket.IO server implementation and Tower layer, while a direct transport design supplies only the lower-level channel and leaves application protocol behavior to the developer.
The library is also not the complete operational boundary around real-time traffic. TLS, authentication, authorization, compression, persistence, and cross-process delivery remain part of the surrounding server or adapter configuration.
Editorial conclusion
Socketioxide fits Rust services that already use Tower or Tokio and need Socket.IO semantics without tying the application to one server framework. It is a poor fit when the project requires a non-Tower HTTP stack or documented installation and compatibility procedures beyond those published by the repository. Before adoption, verify the selected `socketioxide` release against the intended Rust toolchain, test the required Socket.IO client and protocol version, and confirm that the chosen adapter or cluster configuration matches the deployment topology.
Frequently asked questions
Which Rust web frameworks can use Socketioxide?
The README names Axum, Warp, Hyper, Salvo, and Viz, and states that other Tower-based middleware can also be used. Socketioxide integrates through the Tower ecosystem and Tokio stack.
How does Socketioxide install into a Rust project?
The README does not include an installation command or dependency snippet. It directs users to the `socketioxide` documentation on `docs.rs` and its Crates.io listing.
Does Socketioxide support Socket.IO protocol v4?
Yes. The README says protocol v5 is enabled by default, while protocol v4, based on Engine.IO v3, is available through the `v4` feature flag.
Can Socketioxide scale across multiple processes?
The README lists adapters for Redis or Valkey, MongoDB, and PostgreSQL. It also links Socketioxide-emitter for remote cluster communication, but it does not document adapter configuration or consistency guarantees.
What Rust version does the Socketioxide workspace require?
The root `Cargo.toml` declares Rust edition `2024` and `rust-version = "1.94.0"`. Applications should verify their toolchain against those workspace requirements before building the examples.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/totodore-socketioxide)Star history chart for your README
[](https://hysenlabs.com/projects/totodore-socketioxide)Was this useful?