Skip to content

Commit

Permalink
update dependencies further
Browse files Browse the repository at this point in the history
  • Loading branch information
adryzz committed Mar 21, 2024
1 parent 062ced3 commit e1df771
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 40 deletions.
198 changes: 164 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
anyhow = "1.0.72"
axum = { version = "0.6.19", features = ["tracing", "ws"] }
axum = { version = "0.7", features = ["tracing", "ws"] }
axum-macros = "0.3.8"
console-subscriber = "0.1.10"
futures-util = "0.3.28"
Expand All @@ -16,6 +16,6 @@ serde_json = "1.0.104"
serde_repr = "0.1.16"
sqlx = { version = "0.7.1", features = ["sqlite", "runtime-tokio-rustls"] }
tokio = { version = "1.29.1", features = ["full", "tracing"] }
tower-http = { version = "0.4.3", features = ["trace"] }
tower-http = { version = "0.5.2", features = ["trace"] }
tracing = "0.1.37"
tracing-subscriber = "0.3.17"
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ async fn run() -> anyhow::Result<()> {
.layer(TraceLayer::new_for_http())
.with_state(state);

let listener = std::net::TcpListener::bind("0.0.0.0:3000")?;
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
tracing::info!("Listening on {}...", listener.local_addr()?);

axum::Server::from_tcp(listener)?
.serve(app.into_make_service_with_connect_info::<SocketAddr>())
.await?;
axum::serve(listener, app.into_make_service_with_connect_info::<SocketAddr>()).await?;
Ok(())
}

Expand Down
2 changes: 2 additions & 0 deletions src/websockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use axum::{
response::IntoResponse,
};
use futures_util::StreamExt;
use tracing::instrument;
use std::{net::SocketAddr, sync::Arc};
use tokio::select;

Expand All @@ -22,6 +23,7 @@ pub async fn ws_handler(
ws.on_upgrade(move |socket| handle_socket(socket, addr, state))
}

#[instrument(name = "websocket_connection")]
async fn handle_socket(mut socket: WebSocket, who: SocketAddr, state: Arc<AppState>) {
let mut recv = state.tx.subscribe();

Expand Down

0 comments on commit e1df771

Please sign in to comment.