1
0
Fork 0
mirror of https://github.com/tokio-rs/axum.git synced 2025-03-28 17:27:23 +01:00

Update some examples ()

This commit is contained in:
Eray Karatay 2021-10-05 08:50:27 +03:00 committed by GitHub
parent afabded385
commit b7002f68d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 16 deletions
examples
chat
low-level-rustls
tls-rustls

View file

@ -6,8 +6,8 @@ publish = false
[dependencies]
axum = { path = "../..", features = ["ws"] }
tokio = { version = "1.0", features = ["full"] }
futures = "0.3"
tokio = { version = "1", features = ["full"] }
tower = { version = "0.4", features = ["util"] }
tracing = "0.1"
tracing-subscriber = "0.2"
futures = "0.3"

View file

@ -6,16 +6,21 @@
//! cargo run -p example-chat
//! ```
use axum::extract::ws::{Message, WebSocket, WebSocketUpgrade};
use axum::extract::Extension;
use axum::handler::get;
use axum::response::{Html, IntoResponse};
use axum::AddExtensionLayer;
use axum::Router;
use axum::{
extract::{
ws::{Message, WebSocket, WebSocketUpgrade},
Extension,
},
handler::get,
response::{Html, IntoResponse},
AddExtensionLayer, Router,
};
use futures::{sink::SinkExt, stream::StreamExt};
use std::collections::HashSet;
use std::net::SocketAddr;
use std::sync::{Arc, Mutex};
use std::{
collections::HashSet,
net::SocketAddr,
sync::{Arc, Mutex},
};
use tokio::sync::broadcast;
// Our shared state

View file

@ -6,8 +6,8 @@ publish = false
[dependencies]
axum = { path = "../.." }
tokio = { version = "1.0", features = ["full"] }
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1", features = ["full"] }
tokio-rustls = "0.22"
tracing = "0.1"
tracing-subscriber = "0.2"
tokio-rustls = "0.22.0"
hyper = { version = "0.14", features = ["full"] }

View file

@ -10,7 +10,8 @@ use std::{fs::File, io::BufReader, sync::Arc};
use tokio::net::TcpListener;
use tokio_rustls::{
rustls::{
internal::pemfile::certs, internal::pemfile::pkcs8_private_keys, NoClientAuth, ServerConfig,
internal::pemfile::{certs, pkcs8_private_keys},
NoClientAuth, ServerConfig,
},
TlsAcceptor,
};

View file

@ -6,7 +6,7 @@ publish = false
[dependencies]
axum = { path = "../.." }
axum-server = { version = "0.1", features = ["tls-rustls"] }
axum-server = { version = "0.2", features = ["tls-rustls"] }
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = "0.2"