#http #web #framework

axum-tungstenite

WebSocket connections for axum directly using tungstenite

3 unstable releases

Uses new Rust 2021

0.2.0 Dec 10, 2022
0.1.1 Nov 17, 2022
0.1.0 May 15, 2022

#104 in #web-framework

Download history 1/week @ 2022-10-14 1/week @ 2022-10-21 3/week @ 2022-11-04 10/week @ 2022-11-11 44/week @ 2022-11-18 255/week @ 2022-11-25 258/week @ 2022-12-02 205/week @ 2022-12-09 108/week @ 2022-12-16 21/week @ 2022-12-23 176/week @ 2022-12-30 150/week @ 2023-01-06 197/week @ 2023-01-13 290/week @ 2023-01-20

813 downloads per month

MIT license

23KB
414 lines

axum-tungstenite

WebSocket connections for axum directly using tungstenite.

CI Crates.io Documentation

More information about this crate can be found in the crate documentation.

Differences from axum::extract::ws

axum already supports WebSockets through axum::extract::ws. However the fact that axum uses tungstenite under the hood is a private implementation detail. Thus axum doesn't directly expose types from tungstenite, such as tungstenite::Error and tungstenite::Message. This allows axum to update to a new major version of tungstenite in a new minor version of axum, which leads to greater API stability.

This library works differently as it directly uses the types from tungstenite in its public API. That makes some things simpler but also means axum-tungstenite will receive a new major version when tungstenite does.

Which should you choose?

By default you should use axum::extract::ws unless you specifically need something from tungstenite and don't mind keeping up with additional breaking changes.

Safety

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

License

This project is licensed under the MIT license.

Dependencies

~5–10MB
~173K SLoC