@@ -45,8 +45,6 @@ const RETRY_DELAY = 2_500;
4545const DEFAULT_TIMEOUT_MS = 60 * 1000 ;
4646const TIMEOUT_INTERVAL = 5_000 ;
4747
48- const MEGABYTE = 1024 * 1024 ;
49-
5048const l = logger ( 'api-ws' ) ;
5149
5250function eraseRecord < T > ( record : Record < string , T > , cb ?: ( item : T ) => void ) : void {
@@ -213,16 +211,9 @@ export class WsProvider implements ProviderInterface {
213211 this . #websocket = typeof xglobal . WebSocket !== 'undefined' && isChildClass ( xglobal . WebSocket as typeof WebSocket , WebSocket )
214212 ? new WebSocket ( this . endpoint )
215213 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
216- // @ts -ignore - WS may be an instance of w3cwebsocket, which supports headers
217- : new WebSocket ( this . endpoint , undefined , undefined , this . #headers, undefined , {
218- // default: true
219- fragmentOutgoingMessages : true ,
220- // default: 16K (bump, the Node has issues with too many fragments, e.g. on setCode)
221- fragmentationThreshold : 1 * MEGABYTE ,
222- // default: 1MiB (also align with maxReceivedMessageSize)
223- maxReceivedFrameSize : 24 * MEGABYTE ,
224- // default: 8MB (however Polkadot api.query.staking.erasStakers.entries(356) is over that, 16M is ok there)
225- maxReceivedMessageSize : 24 * MEGABYTE
214+ // @ts -ignore - WS may be an instance of ws, which supports options
215+ : new WebSocket ( this . endpoint , undefined , {
216+ headers : this . #headers
226217 } ) ;
227218
228219 if ( this . #websocket) {
0 commit comments