核心 API
核心 API 提供了低层的接口,专门围绕支持 HTTP/2 协议功能而设计。 它专为与现有 HTTP/1 模块 API 兼容而设计。 但是,兼容性 API是。
与 http
API 相比,http2
核心 API 在客户端和服务器之间更加对称。
例如,大多数事件,如 'error'
、'connect'
和 'stream'
,可以由客户端代码或服务器端代码触发。
The Core API provides a low-level interface designed specifically around support for HTTP/2 protocol features. It is specifically not designed for compatibility with the existing HTTP/1 module API. However, the Compatibility API is.
The http2
Core API is much more symmetric between client and server than the
http
API. For instance, most events, like 'error'
, 'connect'
and
'stream'
, can be emitted either by client-side code or server-side code.