Http2Session 类
- 继承自: <EventEmitter>
http2.Http2Session
类的实例表示 HTTP/2 客户端和服务器之间的活动通信会话。
此类的实例不旨在由用户代码直接构造。
每个 Http2Session
实例将表现出略有不同的行为,具体取决于它是作为服务器还是客户端运行。
http2session.type
属性可用于确定 Http2Session
的运行模式。
在服务器端,用户代码很少有机会直接使用 Http2Session
对象,大多数操作通常是通过与 Http2Server
或 Http2Stream
对象的交互来执行的。
用户代码不会直接创建 Http2Session
实例。
服务器端 Http2Session
实例是在接收到新的 HTTP/2 连接时由 Http2Server
实例创建的。
客户端 Http2Session
实例是使用 http2.connect()
方法创建的。
- Extends: <EventEmitter>
Instances of the http2.Http2Session
class represent an active communications
session between an HTTP/2 client and server. Instances of this class are not
intended to be constructed directly by user code.
Each Http2Session
instance will exhibit slightly different behaviors
depending on whether it is operating as a server or a client. The
http2session.type
property can be used to determine the mode in which an
Http2Session
is operating. On the server side, user code should rarely
have occasion to work with the Http2Session
object directly, with most
actions typically taken through interactions with either the Http2Server
or
Http2Stream
objects.
User code will not create Http2Session
instances directly. Server-side
Http2Session
instances are created by the Http2Server
instance when a
new HTTP/2 connection is received. Client-side Http2Session
instances are
created using the http2.connect()
method.