response.createPushResponse(headers, callback)


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

使用给定的头部调用 http2stream.pushStream(),并在成功时将给定的 Http2Stream 封装到新创建的 Http2ServerResponse 中作为回调参数。当 Http2ServerRequest 被关闭时,回调会带着错误 ERR_HTTP2_INVALID_STREAM 被调用。

【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.】