This commit is contained in:
azw 2023-11-12 02:07:18 +00:00
parent b9dc2e1d33
commit 86ce57ca43
4 changed files with 28 additions and 2 deletions

View File

@ -11,6 +11,9 @@ serde = "*"
serde_derive = "*"
serde_json = "*"
tokio = { version = "1", features = ["full"] }
actix = "0.13.1"
actix-web = "4"
actix-web-actors = "4.2.0"
r9 = { path = "../../third_party/librust/r9" }
r9_macro = { path = "../../third_party/librust/r9_macro" }

View File

@ -5,6 +5,7 @@ use r9_macro_derive::SharedFromSelf;
use r9_macro_derive::Singleton;
use f9::app::App;
use f9::app::HttpContext;
use crate::listener::WsListener;
#[derive(SharedFromSelf)]
#[derive(Singleton)]

View File

@ -3,8 +3,21 @@ use std::cell::RefCell;
use r9_macro::SharedFromSelf;
use r9_macro_derive::SharedFromSelf;
use r9_macro_derive::Singleton;
use actix::StreamHandler;
use actix::{Actor, StreamHandler};
use actix_web_actors::ws::{self, Message};
use actix_web::{
dev::ServerHandle,
rt,
web,
App as WebApp,
web::Data,
web::Query,
HttpRequest,
HttpResponse,
HttpServer,
Error,
Responder};
use std::sync::{Arc, Mutex};
#[derive(SharedFromSelf)]
#[derive(Singleton)]
@ -37,7 +50,7 @@ async fn index(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, E
resp
}
async fn run_app(port: u16, app_state: Arc::<AppState>,
async fn run_app(port: u16,
tx: std::sync::mpsc::Sender<ServerHandle>) -> std::io::Result<()> {
let server = HttpServer::new(move || {
WebApp::new()
@ -61,4 +74,12 @@ impl WsListener {
return p;
}
pub fn init(&mut self) {
}
pub fn uninit(&mut self) {
}
}

View File

@ -1,6 +1,7 @@
use f9::app::App;
mod app;
mod listener;
use crate::app::UserApp;
fn main() {