Skip to content

Commit

Permalink
Merge pull request #30 from qualified/permessage-deflate
Browse files Browse the repository at this point in the history
Compress messages to reduce latency
  • Loading branch information
kazk authored Sep 13, 2021
2 parents a1b26b0 + 89fce50 commit b3f6fe7
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 57 deletions.
99 changes: 44 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ url = "2.2.2"

tokio = { version = "1.6.1", features = ["fs", "process", "macros", "rt", "rt-multi-thread"] }
tokio-util = { version = "0.6.7", features = ["codec"] }
warp = { version = "0.3.1", default-features = false, features = ["websocket"] }
warp = { git = "https://github.com/kazk/warp", branch = "permessage-deflate", default-features = false, features = ["websocket"] }

tracing = "0.1.26"
tracing-subscriber = "0.2.18"
Expand Down
3 changes: 2 additions & 1 deletion src/api/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ pub fn handler(ctx: Context) -> impl Filter<Extract = impl Reply, Error = Reject
.and(with_context(ctx))
.and(with_optional_query())
.map(|ws: warp::ws::Ws, ctx, query| {
ws.on_upgrade(move |socket| on_upgrade(socket, ctx, query))
ws.with_compression()
.on_upgrade(move |socket| on_upgrade(socket, ctx, query))
})
}

Expand Down

0 comments on commit b3f6fe7

Please sign in to comment.