http2session.setLocalWindowSize(windowSize)


设置本地端点的窗口大小。windowSize 是要设置的总窗口大小,而不是增量。

¥Sets the local endpoint's window size. The windowSize is the total window size to set, not the delta.

import { createServer } from 'node:http2';

const server = createServer();
const expectedWindowSize = 2 ** 20;
server.on('session', (session) => {

  // Set local window size to be 2 ** 20
  session.setLocalWindowSize(expectedWindowSize);
});const http2 = require('node:http2');

const server = http2.createServer();
const expectedWindowSize = 2 ** 20;
server.on('session', (session) => {

  // Set local window size to be 2 ** 20
  session.setLocalWindowSize(expectedWindowSize);
});

对于 http2 客户端,正确的事件是 'connect''remoteSettings'

¥For http2 clients the proper event is either 'connect' or 'remoteSettings'.