axum-tws
axum-tws is an alternative WebSocket extractor for
axum using
tokio-websockets as the
underlying WebSocket library instead of tungstenite.
It is not a complete drop-in replacement and has no intention to be one. While
your upgrade handler will look the same, working with Message types in
tokio-websockets is slightly different from tungstenite. Please refer to the
tokio-websockets
documentation for
detailed information, or take a look at the example below.
Much of the code has been ported directly from the axum::extract::ws module - all credit goes to the original authors.
Getting Started
Run cargo add axum-tws to add the library to your project.
Echo Server Example
use ;
use ;
async
async
async
Contributing
Contributions are always welcome! If you have an idea for a feature or find a bug, let me know. PR's are appreciated, but if it's not a small change, please open an issue first so we're all on the same page!
License
axum-tws is dual-licensed under either
at your option.