diff --git a/f9/Cargo.toml b/f9/Cargo.toml index 8031997..f5acf75 100644 --- a/f9/Cargo.toml +++ b/f9/Cargo.toml @@ -11,7 +11,10 @@ serde_derive = "*" serde_json = "*" tokio = { version = "1", features = ["full"] } reqwest = { version = "0.11.22", features = ["blocking", "json"] } +actix = "0.13.1" actix-web = "4" +actix-web-actors = "4.2.0" +actix-rt = "1.0.0" r9 = { path = "../r9" } r9_macro = { path = "../r9_macro" } r9_macro_derive = { path = "../r9_macro_derive" } diff --git a/f9/src/app.rs b/f9/src/app.rs index 74accc1..a3d1e0f 100644 --- a/f9/src/app.rs +++ b/f9/src/app.rs @@ -18,6 +18,8 @@ use std::collections::HashMap; use std::any::Any; use serde_derive::Deserialize; use reqwest::blocking; +use actix_web_actors::ws; +use actix::prelude::*; use r9_macro::SharedFromSelf; use r9_macro_derive::SharedFromSelf; @@ -39,6 +41,17 @@ pub struct HttpContext { pub rsp: String } +#[derive(Message)] +#[rtype(result = "()")] +pub struct Message(pub String); + +/// Session is disconnected +#[derive(Message)] +#[rtype(result = "()")] +pub struct Disconnect { + pub id: usize, +} + #[derive(SharedFromSelf)] pub struct App { _self_wp: Weak::>,