response.createPushResponse(headers, callback)


  • headers <HTTP/2 Headers Object> 描述标头的对象
  • callback <Function>http2stream.pushStream() 完成后调用,或者在尝试创建推送的 Http2Stream 失败或被拒绝时调用,或者在调用 http2stream.pushStream() 方法之前关闭 Http2ServerRequest 的状态

使用给定的标头调用 http2stream.pushStream(),如果成功,则将给定的 Http2Stream 包装在新创建的 Http2ServerResponse 上作为回调参数。 当 Http2ServerRequest 关闭时,回调被调用,错误为 ERR_HTTP2_INVALID_STREAM

  • headers <HTTP/2 Headers Object> An object describing the headers
  • callback <Function> Called once http2stream.pushStream() is finished, or either when the attempt to create the pushed Http2Stream has failed or has been rejected, or the state of Http2ServerRequest is closed prior to calling the http2stream.pushStream() method

Call http2stream.pushStream() with the given headers, and wrap the given Http2Stream on a newly created Http2ServerResponse as the callback parameter if successful. When Http2ServerRequest is closed, the callback is called with an error ERR_HTTP2_INVALID_STREAM.