ws gzip
This commit is contained in:
+13
-9
@@ -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<Event>, 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<Event>, stripe: StripeClient) {
|
||||
}
|
||||
});
|
||||
|
||||
Connection {
|
||||
id: rng.gen::<usize>(),
|
||||
account: None,
|
||||
ws: tx,
|
||||
pool: pool.clone(),
|
||||
stripe: stripe.clone(),
|
||||
events: events_tx.clone(),
|
||||
}
|
||||
DeflateHandler::new(
|
||||
Connection {
|
||||
id: rng.gen::<usize>(),
|
||||
account: None,
|
||||
ws: tx,
|
||||
pool: pool.clone(),
|
||||
stripe: stripe.clone(),
|
||||
events: events_tx.clone(),
|
||||
}
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
.listen("127.0.0.1:40055")
|
||||
|
||||
Reference in New Issue
Block a user