dioxus
dioxus copied to clipboard
Liveview learn example don't work
References
https://github.com/DioxusLabs/dioxus/issues/1690
Problem
If we try to follow the documentation of https://dioxuslabs.com/learn/0.4/getting_started/liveview errors occur when compiling the examples:
error[E0432]: unresolved import `axum::extract::ws`
--> src/main.rs:1:21
|
1 | use axum::{extract::ws::WebSocketUpgrade, response::Html, routing::get, Router};
| ^^ could not find `ws` in `extract`
error[E0433]: failed to resolve: could not find `Server` in `axum`
--> src/main.rs:42:11
|
42 | axum::Server::bind(&addr.to_string().parse().unwrap())
| ^^^^^^ could not find `Server` in `axum`
Steps To Reproduce
- Follow the steps in the text (create bin, add dependencies, copy text,...)
- run:
cargo build
Expected behavior
- We can compile and don't get errors.
Environment:
- dependencies:
- axum = "0.7.4"
- dioxus = "0.4.3"
- dioxus-liveview = { version = "0.4.3", features = ["axum"] }
- tokio = { version = "1.35.1", features = ["full"] }
- Rust version: 1.75
- OS info: MacOS Ventura 13.6.3
- App platform: liveview
Questionnaire
- [x] I'm interested in fixing this myself but don't know where to start
- [ ] I would like to fix and I have a solution
- [ ] I don't have time to fix this right now, but maybe later
We need to enable the ws feature on axum like we do in the liveview crate here to get web socket functionality:
https://github.com/DioxusLabs/dioxus/blob/df74e4c2fcf3e4913c2fe7717c0144b7ac2129b4/packages/liveview/Cargo.toml#L35