阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js http2 使用 options.selectPadding()

      Node.js http2 使用 options.selectPadding()

      When options.paddingStrategy is equal to http2.constants.PADDING_STRATEGY_CALLBACK, the HTTP/2 implementation will consult the options.selectPadding() callback function, if provided, to determine the specific amount of padding to use per HEADERS and DATA frame.

      The options.selectPadding() function receives two numeric arguments, frameLen and maxFrameLen and must return a number N such that frameLen <= N <= maxFrameLen.

      const http2 = require('http2');
      const server = http2.createServer({
        paddingStrategy: http2.constants.PADDING_STRATEGY_CALLBACK,
        selectPadding(frameLen, maxFrameLen) {
          return maxFrameLen;
        }
      });
      
      

      The options.selectPadding() function is invoked once for every HEADERS and DATA frame. This has a definite noticeable impact on performance.


      更多内容请参考:Node.js HTTP2,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录