1
This commit is contained in:
parent
69f8764c4a
commit
89c2cb73ff
@ -1,3 +1,4 @@
|
||||
use std::time::{Duration, Instant};
|
||||
use std::rc::{Rc, Weak};
|
||||
use std::cell::RefCell;
|
||||
use r9_macro::SharedFromSelf;
|
||||
@ -18,6 +19,26 @@ use actix_web::{
|
||||
Error,
|
||||
Responder};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use actix::prelude::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct WsSession {
|
||||
/// unique session id
|
||||
pub id: usize,
|
||||
|
||||
/// Client must send ping at least once per 10 seconds (CLIENT_TIMEOUT),
|
||||
/// otherwise we drop connection.
|
||||
pub hb: Instant,
|
||||
|
||||
/// joined room
|
||||
pub room: String,
|
||||
|
||||
/// peer name
|
||||
pub name: Option<String>,
|
||||
|
||||
// server
|
||||
pub addr: Addr<WsConn>,
|
||||
}
|
||||
|
||||
#[derive(SharedFromSelf)]
|
||||
#[derive(Singleton)]
|
||||
@ -26,7 +47,7 @@ pub struct WsListener {
|
||||
}
|
||||
|
||||
/// Define HTTP actor
|
||||
struct WsConn;
|
||||
pub struct WsConn;
|
||||
|
||||
impl Actor for WsConn {
|
||||
type Context = ws::WebsocketContext<Self>;
|
||||
|
0
server/stat/src/listener/wssession.rs
Normal file
0
server/stat/src/listener/wssession.rs
Normal file
Loading…
x
Reference in New Issue
Block a user