tokio-tungstenite documents a rustls panic that covers its own current version, and publishes no test suite
Future-based Tungstenite for Tokio. Lightweight stream-based WebSocket implementation
At a glance
- What is it?
- A thin Tokio binding over the tungstenite-rs WebSocket library, version 0.30.0, edition 2018, minimum compiler 1.85. Its feature graph is small enough to read in one sitting, its documentation build turns every feature on at once, and the crate it ships to the registry leaves the conformance suite behind.
- Who is it for?
- tokio-tungstenite is a reasonable choice when you already run Tokio and want the WebSocket behavior of tungstenite without writing the asynchronous plumbing yourself: the dependency entry is one line, the feature graph is short, and the examples in the published package cover both ends of a connection. Two things deserve a look before you adopt it.
- 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 28 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 21, 2026, and from our analysis. They are not legal advice.
Star history
- snapview/tokio-tungstenite2,524 ★ · +13
| Repository | 2026-09-29 | 2026-11-21 |
|---|---|---|
| snapview/tokio-tungstenite | 2.5k | 2.5k |
13 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Default features stop at handshake, and stream declares nothing of its own
The whole dependency step is one entry in Cargo.toml:
[dependencies]
tokio-tungstenite = "0.30"After that the guidance is a pointer to the examples directory, plus a pointer to Tokio itself for readers without runtime experience. Past that, the default feature set is connect and handshake, and each pulls in something. connect requires stream, tokio/net and handshake, while handshake forwards straight to the same-named feature of the underlying tungstenite crate. stream itself is declared with an empty dependency list, so the feature that three others name directly, connect, native-tls and the internal feature both rustls variants share, contributes nothing on its own and behaves as a switch other configuration can key on. A user who needs only the server side handshake has a smaller set available than a default build, and a user who hands the crate a URL string needs the url feature, which is also off by default.
Three TLS flags, none of them on by default, under a quantifier for two
TLS is supported on all platforms the same way the underlying crate supports it: through a feature flag, with a wss:// connection unavailable until one is chosen. Three are named. native-tls, rustls-tls-native-roots and rustls-tls-webpki-roots, each paired with a source of root certificates, and a fourth, native-tls-vendored, layers a vendored build of the native TLS library on top of the first. The sentence introducing them reads that TLS is supported using native-tls or rustls through feature flags, then says neither is enabled by default, applying a two-item quantifier to a list of three. The practical part of the choice is the split between native roots and webpki roots, and beyond pointing at the manifest the repository adds no guidance on which to pick.
The rustls panic warning covers the version the manifest declares
One bug is called out by name. If the rustls features are used with version 0.23.0 or later, a reader might observe a panic, described as easy to fix, with two issue links attached for the report and for the discussion of it. The manifest declares version 0.30.0 and pins the optional rustls dependency at 0.23.0, so the condition as written applies to the current release rather than to a superseded one. Someone choosing rustls is choosing the configuration the warning was filed against, and the sentence does not say which combination of crates triggers the panic or what the fix consisted of. The two links are the only pointer to a resolution, and neither is restated in the text.
The documentation build turns every feature on, so the docs are not the default build
The manifest asks the documentation host for a build with all features enabled. That one line changes what a reader sees, because every page is generated from a configuration with both TLS stacks compiled in, the url feature present and the connection path active, while the default feature set is only connect and handshake. Someone looking for the API surface gets all of it at once, which is convenient, but the pages cannot show what a default build contains or which items exist only behind a flag. The same manifest pins its documentation link to version 0.30.0, while the README links to the unversioned documentation address, so a current copy of the docs and a copy that tracks whatever is newest sit one URL apart.
The published crate leaves out its conformance suite, its scripts and its tests
The include list for the published package names five entries: everything under examples, everything under src, the license, the readme and the changelog. The repository root also holds a tests directory, an autobahn directory, a scripts directory, rustfmt.toml and a GitHub workflows directory, and none of those travel with the crate. The autobahn directory together with the pair of autobahn client and server examples is the part that matters to anyone who wants to check protocol conformance for themselves, because taking the published package as a dependency leaves no way to run them. The examples that do ship include a client, two plain servers, an interval server and two handshake variants, so a copy taken from the registry can be run but not re-verified.
Performance is capped by the crate underneath, and the faster alternative is named
The performance section is the most direct passage in the file. It states that the crate is a wrapper, so performance is capped by the underlying tungstenite, that tungstenite has a decent performance after production use in real-time communication software and video conferencing, and that it is definitely not the fastest WebSocket library in the world at the moment of writing. It goes on to say that changes in both crates are needed to reach parity with a faster library, fastwebsockets, and that versions above 0.26.2 should be closer to that parity. The manifest version, 0.30.0, sits above that threshold, and a comment on the underlying crate's issue tracker holds the summary of what is still pending. No measurement appears anywhere in the file.
Edition 2018, a 1.85 compiler floor, and defaults switched off on every dependency
The manifest pairs edition 2018 with a rust-version floor of 1.85, which is a far newer compiler than the edition it targets. The dependency declarations are trimmed the same way each time: futures-util, tokio, tungstenite and rustls all appear with default features switched off, with futures-util re-enabling only the sink and std features and tokio asking only for io-util. That keeps the compiled surface narrow and matches the Lightweight wording in the package description, but it also means anything expected from those crates by default has to be named explicitly in the manifest. The dependency entries shown end at the optional rustls-pki-types line, so the development dependencies used by the test suite do not appear among them.
A dangling preposition in the sentence that defines the crate
The paragraph explaining what the crate is reads that it is based on the tungstenite-rs library and provides Tokio bindings and wrappers for it, so you can use it with non-blocking asynchronous TcpStreams from and couple it together with other crates from the Tokio stack. The words from and couple sit next to each other with nothing between them, so the sentence names the stream type and then breaks before finishing its own clause. The same one-line description appears twice in different words: the package description calls it a Tokio binding for Tungstenite, while the repository description calls it Future-based Tungstenite for Tokio. Both name tungstenite-rs as the base, and neither mentions a version, a feature or the compiler floor the manifest states.
Editorial conclusion
tokio-tungstenite is a reasonable choice when you already run Tokio and want the WebSocket behavior of tungstenite without writing the asynchronous plumbing yourself: the dependency entry is one line, the feature graph is short, and the examples in the published package cover both ends of a connection. Two things deserve a look before you adopt it. The README documents a panic that appears when the rustls features are used with version 0.23.0 and later, and the current manifest version sits inside that range, so read the two linked issues before choosing rustls over native-tls. Then decide whether your build wants everything on, because the published documentation is generated that way while the default feature set is only connect and handshake. If you intend to check protocol conformance yourself, take it from the repository rather than the registry: the published package ships neither the tests nor the autobahn directory.
Frequently asked questions
what is tokio tungstenite
It is a Rust crate built on the tungstenite-rs WebSocket library that supplies Tokio bindings and wrappers, so it can be used with non-blocking asynchronous TcpStream values and alongside other crates from the Tokio stack. The manifest declares it at version 0.30.0 under the MIT license.
how to use tokio tungstenite
Add a tokio-tungstenite = 0.30 entry under dependencies in Cargo.toml, then work from the examples directory, which holds a client, two servers, an interval server, two handshake variants and the autobahn pair. The README also points readers to Tokio itself for the runtime background.
Does tokio-tungstenite support wss:// without extra configuration?
No. TLS support sits behind the native-tls, rustls-tls-native-roots or rustls-tls-webpki-roots feature flags, and none of them is enabled by default, so a secure connection needs one chosen explicitly before it will work.
Is tokio-tungstenite faster than fastwebsockets?
The performance section says the crate is a wrapper around tungstenite, so performance is capped by that crate, and that versions above 0.26.2 should be closer to parity with fastwebsockets. The manifest version is 0.30.0, and no measurement is reported.
How does tokio-tungstenite compare with axum?
The repository does not mention axum anywhere, so nothing in it supports that comparison. What it does state is that the crate is a Tokio binding for tungstenite-rs, that the default feature set is connect and handshake, and that TLS and the url feature are opt-in.
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/snapview-tokio-tungstenite)Star history chart for your README
[](https://hysenlabs.com/projects/snapview-tokio-tungstenite)Was this useful?