1
This commit is contained in:
parent
b9dc2e1d33
commit
86ce57ca43
@ -11,6 +11,9 @@ serde = "*"
|
|||||||
serde_derive = "*"
|
serde_derive = "*"
|
||||||
serde_json = "*"
|
serde_json = "*"
|
||||||
tokio = { version = "1", features = ["full"] }
|
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 = { path = "../../third_party/librust/r9" }
|
||||||
r9_macro = { path = "../../third_party/librust/r9_macro" }
|
r9_macro = { path = "../../third_party/librust/r9_macro" }
|
||||||
|
@ -5,6 +5,7 @@ use r9_macro_derive::SharedFromSelf;
|
|||||||
use r9_macro_derive::Singleton;
|
use r9_macro_derive::Singleton;
|
||||||
use f9::app::App;
|
use f9::app::App;
|
||||||
use f9::app::HttpContext;
|
use f9::app::HttpContext;
|
||||||
|
use crate::listener::WsListener;
|
||||||
|
|
||||||
#[derive(SharedFromSelf)]
|
#[derive(SharedFromSelf)]
|
||||||
#[derive(Singleton)]
|
#[derive(Singleton)]
|
||||||
|
@ -3,8 +3,21 @@ use std::cell::RefCell;
|
|||||||
use r9_macro::SharedFromSelf;
|
use r9_macro::SharedFromSelf;
|
||||||
use r9_macro_derive::SharedFromSelf;
|
use r9_macro_derive::SharedFromSelf;
|
||||||
use r9_macro_derive::Singleton;
|
use r9_macro_derive::Singleton;
|
||||||
use actix::StreamHandler;
|
use actix::{Actor, StreamHandler};
|
||||||
use actix_web_actors::ws::{self, Message};
|
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(SharedFromSelf)]
|
||||||
#[derive(Singleton)]
|
#[derive(Singleton)]
|
||||||
@ -37,7 +50,7 @@ async fn index(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, E
|
|||||||
resp
|
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<()> {
|
tx: std::sync::mpsc::Sender<ServerHandle>) -> std::io::Result<()> {
|
||||||
let server = HttpServer::new(move || {
|
let server = HttpServer::new(move || {
|
||||||
WebApp::new()
|
WebApp::new()
|
||||||
@ -61,4 +74,12 @@ impl WsListener {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn init(&mut self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn uninit(&mut self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use f9::app::App;
|
use f9::app::App;
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
|
mod listener;
|
||||||
use crate::app::UserApp;
|
use crate::app::UserApp;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user