fix(connect): disable context takeover in websocket transport
The `threshold` option in `perMessageDeflate` is ignored due to context takeover being enabled. This leads to WebSocket RPC messages being unconditionally compressed. Most RPC channel messages are small, and unconditionally performing message compression has measurable performance impact. Disable context takeover (for both server and client) to let compression threshold option to take effect.
This commit is contained in:
parent
733f9a2926
commit
4a4018bbfe
|
|
@ -24,6 +24,7 @@ import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from '../utils/happy-
|
||||||
import type { HeadersArray } from './types';
|
import type { HeadersArray } from './types';
|
||||||
|
|
||||||
export const perMessageDeflate = {
|
export const perMessageDeflate = {
|
||||||
|
clientNoContextTakeover: true,
|
||||||
zlibDeflateOptions: {
|
zlibDeflateOptions: {
|
||||||
level: 3,
|
level: 3,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ let lastConnectionId = 0;
|
||||||
const kConnectionSymbol = Symbol('kConnection');
|
const kConnectionSymbol = Symbol('kConnection');
|
||||||
|
|
||||||
export const perMessageDeflate = {
|
export const perMessageDeflate = {
|
||||||
|
serverNoContextTakeover: true,
|
||||||
zlibDeflateOptions: {
|
zlibDeflateOptions: {
|
||||||
level: 3,
|
level: 3,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue