Disable websocket outgoing message fragmentation for w3cwebsocket (#2738)

* Disable websocket outgoing message fragmentation for w3cwebsocket

* Message fragmentation with 256K fragment size

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
This commit is contained in:
Mokhtar Naamani
2020-10-16 21:57:26 +02:00
committed by GitHub
co-authored by Jaco Greeff
parent c5fcb0d06b
commit 773618acfb
+6 -1
View File
@@ -150,7 +150,12 @@ export default class WsProvider implements ProviderInterface {
? new WS(this.#endpoints[this.#endpointIndex])
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
: new WS(this.#endpoints[this.#endpointIndex], undefined, undefined, this.#headers);
: new WS(this.#endpoints[this.#endpointIndex], undefined, undefined, this.#headers, undefined, {
// default: true
fragmentOutgoingMessages: true,
// default: 16K
fragmentationThreshold: 256 * 1024
});
this.#websocket.onclose = this.#onSocketClose;
this.#websocket.onerror = this.#onSocketError;