things
This commit is contained in:
parent
18b644d24b
commit
b2c3a521e9
8 changed files with 115 additions and 9 deletions
|
@ -27,3 +27,5 @@ base64 = "0.21.7"
|
|||
sha256 = "1.5.0"
|
||||
reqwest = { version = "0.11.23", features = ["json", "gzip", "brotli", "multipart"] }
|
||||
chrono = "0.4.31"
|
||||
futures = "0.3.30"
|
||||
tokio-tungstenite = { version = "0.21.0", features = ["rustls"] }
|
||||
|
|
|
@ -2,6 +2,7 @@ mod account;
|
|||
mod auth;
|
||||
mod node;
|
||||
mod proxy;
|
||||
mod ws;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
23
identity/src/http/ws/mod.rs
Normal file
23
identity/src/http/ws/mod.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use axum::{extract::{ws::WebSocket, WebSocketUpgrade}, response::Response, Extension};
|
||||
use futures::{
|
||||
stream::{SplitSink, SplitStream, StreamExt},
|
||||
SinkExt,
|
||||
};
|
||||
|
||||
use crate::{app_state::AppState, model::account::Account};
|
||||
|
||||
pub async fn handler(ws: WebSocketUpgrade, Extension(state): Extension<Arc<AppState>>) -> Response {
|
||||
ws.on_upgrade(|socket| handle_socket(state, socket))
|
||||
}
|
||||
|
||||
struct SocketState {
|
||||
user: Option<Account>,
|
||||
}
|
||||
|
||||
async fn handle_socket(app_state: Arc<AppState>, socket: WebSocket) {
|
||||
let (sender, receiver) = socket.split();
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue