diff --git a/WORKLOG.md b/WORKLOG.md index 42df418e..298e552d 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -6,7 +6,6 @@ * can't reset password without knowing password =\ * ws gzip encoding -* skip faceoff for practice * concede round * look into ruin event bug diff --git a/server/Cargo.toml b/server/Cargo.toml index 8152eff9..5374775f 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -34,7 +34,7 @@ router = "0.6" mount = "0.4" cookie = "0.12" crossbeam-channel = "0.3" -ws = { version = "0.8", features = ["ssl"] } +ws = { version = "0.8", features = ["ssl", "permessage-deflate"] } lettre = "0.9" lettre_email = "0.9" diff --git a/server/src/rpc.rs b/server/src/rpc.rs index 0e5fa28d..948a07f4 100644 --- a/server/src/rpc.rs +++ b/server/src/rpc.rs @@ -16,6 +16,7 @@ use stripe::{Client as StripeClient, Subscription}; use crossbeam_channel::{unbounded, Sender as CbSender}; use ws::{Builder, CloseCode, Message, Handler, Request, Response, Settings, Sender as WsSender}; +use ws::deflate::DeflateHandler; use account::{Account}; use account; @@ -448,7 +449,8 @@ impl Handler for Connection { pub fn start(pool: PgPool, events_tx: CbSender, stripe: StripeClient) { let mut rng = thread_rng(); - Builder::new() + + let ws = Builder::new() .with_settings(Settings { max_connections: 10_000, ..Settings::default() @@ -478,14 +480,16 @@ pub fn start(pool: PgPool, events_tx: CbSender, stripe: StripeClient) { } }); - Connection { - id: rng.gen::(), - account: None, - ws: tx, - pool: pool.clone(), - stripe: stripe.clone(), - events: events_tx.clone(), - } + DeflateHandler::new( + Connection { + id: rng.gen::(), + account: None, + ws: tx, + pool: pool.clone(), + stripe: stripe.clone(), + events: events_tx.clone(), + } + ) }) .unwrap() .listen("127.0.0.1:40055")