DioxusLabs / DioxusLabs/dioxus
Axum servers are not fully compatible with dioxus
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## The problem
This axum server implementation is different from a default axum server.
This axum server uses
- a wrapped TcpListener and a wrapped TcpStream (which drops data present in memory when TcpStream is dropped)
- a custom type for getting client's socket information
- a graceful shutdown signal
This is how my main function looked like before integrating dioxus
```rs
#[tokio::main]
async fn main() {
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
dotenv::dotenv().ok();
tracing_subscriber::registry()
.with(tracing::level_filters::LevelFilter::from_level(tracing::Level::DEBUG))
.with(tracing_subscriber::fmt::Layer::default())
.init();
axum::serve(
server::get_custom_listener().await,
server::routes().await.into_make_service_with_connect_info::(),
)
.with_graceful_shutdown(shutdown_signal())
.await
.unwrap();
}
// inside server crate
pub async fn get_custom_listener(addr: std::net::SocketAddr) -> stream_drop::CustomListener {
use axum::serve::Listener;
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
let custom_listener = stream_drop::CustomListener::from(listener);
tracing::info!("[+] listening on {}", custom_listener.local_addr().unwrap());
custom_listener
}
```
# Feature Request
Currently in dioxus has no way to
- Get client socket information
- Create a custom TcpStream type that will drop data from server when the stream is dropped from client
- There is no way to shutdown server gracefully
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing Dioxus's server integration and comparing it with the axum::serve example in the issue. Check how the server crate currently handles listener and stream types, client socket information, and shutdown; done means all three requested capabilities are supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100