tokio-websockets
High performance, strict, tokio-util based WebSockets implementation
0.13.3
12M downloads/mo
#2830 most downloaded on crates.io
Gelbpunkt/tokio-websockets
What this package is like to depend on
Last release 1 months ago
25 Jun 2026
Ships fairly regularly
a new release about every 2 months
Most releases are documented
notes for 25 of 31 stable releases
1 version withdrawn
withdrawn after publishing
4 years old
32 releases · first in 2022
6 releases in the last 12 months
see the full history below
Release timeline
32 releases · Dec 2022 to Jun 2026Releases
latest 32-
0.13.325 Jun 2026 -
0.13.217 Mar 2026Release notes
Open source →Added
- On loongarch64, frame (un)masking can now also make use of LSX alongside the existing LASX support
Changed
- getrandom was upgraded to 0.4, rand was upgraded to 0.10
Fixed
- Compilation with the
nightlyfeature enabled now works on s390x with the latest Rust nightlies again
-
0.13.128 Dec 2025Release notes
Open source →Added
- The new
WebSocketStream::into_innermethod discards the WebSocket stream and provides you with the raw underlying I/O - It is now possible to add custom headers to the built-in server's Switching Protocols response via
ServerBuilder::add_header
Fixed
- Compilation with the
nightlyfeature enabled on s390x now works with the latest nightlies again - Fixed a case of UB in the ARM NEON intrinsic code uncovered by Miri
Other
- CI now test builds all feature combinations on architectures supported by the SIMD code (aarch64, loongarch64, ppc64le, s390x, x86_64)
- Further, on aarch64, ppc64le, s390x and x86_64 we now also run the tests with Miri
- The new
-
0.13.007 Oct 2025Release notes
Open source →Added
- With the
nightlyfeature enabled and no random number generator enabled,std::randomwill now be used
Changed
- [breaking] The default
rustlscrypto provider is now installed implicitly, which in turn results inTlsConnector::nownow panicking instead of returning the now-removedNoCryptoProviderConfigurederror variant - [breaking] The MSRV is now 1.89, which means AVX512 support is now available without the
nightlyfeature
- With the
-
0.12.328 Sep 2025 -
0.12.228 Sep 2025Release notes
Open source →Fixed
- The minimum version requirement for
fastrandwas corrected to2.2.0to match reality
- The minimum version requirement for
-
0.12.121 Aug 2025Release notes
Open source →Fixed
- Fixed an out-of-bounds access when sending a large number of messages at once
-
0.12.010 Jul 2025Release notes
Open source →Added
- With the
nightlyfeature enabled, SIMD-accelerated masking is now supported on s390x and loongarch64
Changed
webpki-rootswas upgraded to 1.xrustls-platform-verifierwas upgraded to 0.6- Multiple pending messages are now written in a single vectored write, improving performance when using
SinkExt::feed - [breaking] The
rustls-related features now require configuring a global crypto provider for rustls
Fixed
- After writing the WebSocket upgrade request, the connection was not flushed, so in some cases with buffering, the connection would be stuck trying to read an upgrade response
Removed
- [breaking] The
simdfeature flag was removed - it had no effect since 0.11.1, SIMD support is now detected at runtime
- With the
-
0.11.418 Apr 2025Release notes
Open source →Fixed
- Fixed an issue where
poll_nextwould not attempt to flush to stream when there is data to be sent. This is achieved by storing and then reusing the writer task's waker inpoll_next.
- Fixed an issue where
-
0.11.317 Feb 2025Release notes
Open source →Fixed
- In cases where the underlying I/O was failed but data remained to be sent, a call to
poll_closethe WebSocket stream would block indefinitely, this is now properly handled by returningNonefrompoll_nextafter I/O errors
- In cases where the underlying I/O was failed but data remained to be sent, a call to
-
0.11.209 Feb 2025Release notes
Open source →Changed
randwas updated to 0.9- Reduced the amount of unsafe code
Fixed
- The
Hostheader no longer unconditionally includes a port anymore, which is more in line with the RFC and fixes interacting with some webservers
-
0.11.126 Jan 2025Release notes
Open source →Changed
- The size of several structs has been slightly decreased, reducing memory usage
- The SIMD algorithms have been improved and support for them is now detected at runtime. The
simdfeature flag is deprecated getrandomwas updated to 0.3
Fixed
- Fixed an issue where a pending
poll_flushcall by a writer would stall infinitely ifpoll_nextwas called at the same time (see #92)
-
0.11.003 Jan 2025Release notes
Open source →Added
- The SIMD masking code now supports AltiVec on PowerPC targets (nightly only)
WebSocketStream::{get_ref, get_mut}allow access to the underlying I/Oclient::DISALLOWED_HEADERSis a list of headers that may not be added viaClientBuilder::add_headerCloseCode::is_reservedreturns whether the close code is reserved (i.e. may not be sent over the wire)
Changed
- [breaking]
ServerBuilder::acceptnow returns the client's HTTP request alongside the websocket stream in a tuple - [breaking]
ClientBuilder::add_headernow returns aResultand errors when adding a disallowed header - [breaking]
Message::closewill now panic when the close code is reserved or the reason exceeds 123 bytes - [breaking]
Message::{ping, pong}will now panic when the payload exceeds 125 bytes rustls-platform-verifierwas updated to 0.5- The SIMD masking code is now more efficient
Fixed
- Fixed compilation with SIMD on 32-bit x86 targets
- 32-bit ARM NEON is unstable in rustc and now correctly gated behind the
nightlyfeature
-
0.10.113 Sep 2024Release notes
Open source →Added
- The new
rustls-bring-your-own-connectorfeature allows for creating aConnector::Rustlsinstance without pulling in any other certificate roots - The sink flush threshold is now configurable via
Config::flush_threshold
Changed
Config::frame_sizenow panics when the frame size is set to 0- Reduced the number of allocations which was caused by a misunderstanding of
BytesMut::reserveinternals, improving throughput by up to 30% - The number of pending bytes to be written is no longer calculated in a potentially expensive loop in
poll_ready, but rather tracked as messages are queued
Fixed
- Fixed a case of possible UB in the UTF-8 validator discovered by the new fuzzer (@finnbear)
- The UTF-8 validator now uses the faster validation for partial codepoints as intended, earlier this was only the case if the number of bytes available matched the number expected
- The new
-
0.10.004 Sep 2024Release notes
Open source →Added
Error::NoNativeRootCertificatesFoundwas added and is returned inTlsConnector::newif no native root certificates were found and the rustls-webpki-roots feature is not enabled
Changed
- If no crypto provider is specified via crate features, tokio-websockets will now try to use the installed default provider in rustls
TlsConnector::newis now always available- [breaking]
Error::NoTlsConnectorConfiguredwas removed and replaced byError::NoCryptoProviderConfigured rustls-native-certswas updated to 0.8
Fixed
- Fixed an issue where connecting to an IPv6 address would fail
- Specify the actual minimum version required of rustls-platform-verifier
-
0.9.004 Aug 2024Release notes
Open source →Added
Payloadnow implementsFrom<Vec<u8>>Payloadnow also implementsInto<BytesMut>, which is a cheap conversion unless multiple references to the backing buffer exist
Changed
- [breaking] The MSRV is now 1.79, allowing use of
split_at_mut_uncheckedto make some unsafe code less error prone - [breaking] The minimum required version of bytes is now 1.7
- [breaking] The
Resolvertrait now uses async fn syntax - The
From<String>implementation onPayloadnow usesBytesMutinternally, improving performance in some cases - The
From<Bytes>implementation onPayloadnow usesBytesMutinternally if cheaply possible, improving performance in some cases
-
0.8.324 May 2024Release notes
Open source →Fixed
- Fixed an unsafe precondition violation triggered upon receiving close messages with empty reason
-
0.8.216 Apr 2024 -
0.8.116 Apr 2024Release notes
Open source →Added
- Added support for
rustls-platform-verifiervia a feature with the same name
Fixed
- Fixed the docs.rs build
- Added support for
-
0.8.015 Apr 2024Release notes
Open source →Added
- Support for
aws_lc_rsas a SHA1 and crypto provider was added via theaws_lc_rsfeature, optionally also FIPS-compliant via thefipsfeature - The new
rustls-tls12feature will enable TLS1.2 support in rustls
Changed
- [breaking] The rustls dependency was updated to 0.23 and tokio-rustls to 0.26
- [breaking] The minimum required version of tokio-util is now 0.7.3
- A bunch of leftover unused
Encoderimplementations and the associated write buffers were removed - The
clientfeature no longer depends ontokio/rt
Fixed
- The
nightlyfeature now enables thestdarch_x86_avx512nightly feature only on x86_64 instead of all architectures - The documentation for
Config::frame_sizewas ambiguous about whether it affected the payload size or the entire frame size, this has been clarified to be the payload size
Removed
- The
http-integrationfeature and associatedupgrade_requestmethod were removed, it offered little to no value over manually crafting a request and bloated the dev-dependency stack unnecessarily
- Support for
-
0.7.027 Feb 2024Release notes
Open source →Changed
- [breaking] The future returned from
Resolver::resolveis now required to beSend. This restores backwards compatibility with 0.5.x
- [breaking] The future returned from
-
0.6.027 Feb 2024Release notes
Open source →Added
Payloadnow implementsFrom<&'static [u8]>andFrom<&'static str>- The
ClientBuildernow allows specifying a DNS resolver that implements theResolvertrait viaClientBuilder::resolver, stored as a generic on the builder. It defaults toresolver::Gai, which matches behavior on previous versions
Changed
- [breaking]
ClientBuilder::connectnow returns anError::UnsupportedSchemeif the URI does not set the scheme towsorwss - [breaking]
ClientBuilder::connectwill no longer unconditionally use the specified custom connector, instead it will always use a plain connector for thewsscheme - [breaking] The
nightlyfeature now uses the newstdsimdfeature instead ofstdarch_x86_avx512, which was removed in recent nightly compiler versions
Fixed
- The
Debugimplementation ofConnectornow prints the correct name of theRustlsvariant - The header buffer size in the built-in server was increased to 64, which allows clients sending larger amounts of headers to connect
- Fixed a case of UB when a message was constructed via
Message::textwith invalid UTF-8 and then converted to a&strviaMessage::as_text. This will now cause a panic
-
0.5.129 Dec 2023 withdrawnRelease notes
Open source →Changed
Message::textnow takesInto<Payload>instead ofString, which now implementsInto<Payload>
-
0.5.011 Dec 2023Release notes
Open source →Dependencies
- Updated
httpto 1.0 andrustls-related dependencies to those compatible withrustls0.22 - [breaking]
ringis now an optional dependency withrustlsand different crypto providers can be used - Optimized
simdutf8feature flags for aarch64
Changed
- [breaking]
upgrade_requestno longer uses an explicit body type, now it only requires the body to implementDefault - [breaking]
WebsocketStreamhas been renamed toWebSocketStream - [breaking]
Messagepayloads are now exposed asPayloadand it is possible to create messages fromBytes-backed payloads - Removed a few excess allocations in hot paths
Fixed
- Fixed issues with the close sequence handling
- Updated
-
0.4.123 Nov 2023Release notes
Open source →Fixed
- Fixed invalid opcode errors when intermediate control frames were received
-
0.4.010 Sep 2023Release notes
Open source →Dependencies
- Update
webpkito 0.24,webpki-rootsto 0.25 andrust-webpkito 0.101
Added
- Added support for NEON-accelerated frame (un)masking
- Added support for AVX512-accelerated frame (un)masking, gated behind the
nightlyfeature flag and requires a nightly compiler - Limits for payload length can be applied via
{ClientBuilder, ServerBuilder}::limitsto protect against malicious peers - The websocket stream can now be configured via
{ClientBuilder, ServerBuilder}::config. This currently only supports changing the frame payload size that outgoing messages are chunked into
Changed
- The crate now specifies and validates a MSRV of Rust 1.64
- The library now validates UTF-8 in partial continuation frames to a text message
- Several types now implement
Debug - The performance of the decoder has been improved
- The encoder is now usually zero-copy and operates in-place when possible
- Reduced the amount of calls to
fastrand upgrade::Erroris now publicly accessible and can thus be matched on- [breaking]
ClientBuildermethods which perform a handshake now return a tuple of(WebsocketStream, Response)to retrieve e.g. response headers - [breaking]
WebsocketStreamis now fully cancellation safe and implementsStream, therefore usingWebsocketStream::nextnow requires havingStreamExtin scope - [breaking]
CloseCodeis now a wrapper around aNonZeroU16instead of an enum. Enum variants have been moved to associated constants. This fixes possible creation of disallowed close codes by the user - [breaking] All error types are now marked as
non_exhaustiveto prevent consumer build breakage when new variants are added - [breaking] Emptied default features
Removed
- [breaking]
{ClientBuilder, ServerBuilder}::fail_fast_on_invalid_utf8has been removed and is now always enabled because our implementation for streaming UTF-8 validation is already efficient enough, benchmarks show no gains anymore - [breaking] Some error variants have been removed and coalesced into other variants (mostly into
InvalidOpcode).ConnectionClosedhas been entirely removed in favor of returningNonefrompoll_nextbecause it is more idiomatic - [breaking]
WebsocketStream::closehas been removed. TheSinkExt::closeimplementation will send a default close message and properly shut down the sink. Custom close messages can be sent viaSinkExt::sendfollowed bySinkExt::close - The
futures-utildependency has been removed
Fixed
- A few inconsistencies with the websocket RFC have been fixed
- Update
-
0.3.316 Jun 2023Nothing published for this version
-
0.3.211 May 2023Nothing published for this version
-
0.3.111 May 2023Nothing published for this version
-
0.3.023 Apr 2023Nothing published for this version
-
0.2.006 Dec 2022Nothing published for this version
-
0.1.006 Dec 2022Nothing published for this version