dzura/server/src/app/connection.rs
2024-12-17 12:52:41 -08:00

25 lines
533 B
Rust

use std::sync::Arc;
use tokio::sync::RwLock;
use futures::stream::SplitSink;
use hyper::upgrade::Upgraded;
use hyper_util::rt::TokioIo;
use tokio_tungstenite::{tungstenite::Message, WebSocketStream};
use crate::app::{
authentication::AuthToken,
context::Context,
};
type StreamType = Arc<RwLock<SplitSink<WebSocketStream<TokioIo<Upgraded>>, Message>>>;
#[derive(Clone)]
pub struct Connection {
pub stream:StreamType,
pub auth:Option<AuthToken>,
pub context:Context,
pub prev:u32,
pub next:u32,
}