mkurz commented on code in PR #1114:
URL: https://github.com/apache/pekko-http/pull/1114#discussion_r3504893791
##########
http-core/src/main/resources/reference.conf:
##########
@@ -348,6 +348,44 @@ pekko.http {
# Enable verbose debug logging for all ingoing and outgoing frames
log-frames = false
+
+ compression {
+ # Whether the server should support WebSocket compression using the
RFC 7692
+ # permessage-deflate extension. Compression is negotiated during the
+ # WebSocket handshake and is only used when the client requests it.
+ enabled = true
Review Comment:
Did some research if netty has similiar feature(s):
What Netty does have is lower-level extension filters:
```java
WebSocketExtensionFilter.mustSkip(WebSocketFrame frame)
```
Those filters can decide per frame whether an extension encoder/decoder
should be skipped. Netty’s own tests show a threshold-style example:
```java
return (frame instanceof TextWebSocketFrame || frame instanceof
BinaryWebSocketFrame)
&& frame.content().readableBytes() < 100;
```
So Netty supports the mechanism for "don’t compress small messages", but it
does not ship a named adaptive compression feature/config. Its default is
`WebSocketExtensionFilterProvider.DEFAULT`, which means `NEVER_SKIP`, so
negotiated messages are compressed.
Important detail: for `permessage-deflate`, Netty forbids changing the
decision in the middle of a fragmented message. If compression/decompression is
already in progress and the filter suddenly says “skip” for a continuation
frame, Netty throws.
So yeah, maybe in a follow up PR it might make sense to think about some
mechanism to dynamicaly decide if an outbound message should be compressed or
not
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]