事件:'upgrade'
¥Event: 'upgrade'
-
request
<http.IncomingMessage> HTTP 请求的参数,如它在'request'
事件中¥
request
<http.IncomingMessage> Arguments for the HTTP request, as it is in the'request'
event -
socket
<stream.Duplex> 服务器和客户端之间的网络套接字¥
socket
<stream.Duplex> Network socket between the server and client -
head
<Buffer> 升级流的第一个数据包(可能为空)¥
head
<Buffer> The first packet of the upgraded stream (may be empty)
每次客户端请求 HTTP 升级时触发。监听此事件是可选的,客户端不能坚持协议更改。
¥Emitted each time a client requests an HTTP upgrade. Listening to this event is optional and clients cannot insist on a protocol change.
触发此事件后,请求的套接字将没有 'data'
事件监听器,这意味着需要绑定它才能处理发送到该套接字上的服务器的数据。
¥After this event is emitted, the request's socket will not have a 'data'
event listener, meaning it will need to be bound in order to handle data
sent to the server on that socket.
除非用户指定 <net.Socket> 以外的套接字类型,否则此事件保证传入 <net.Socket> 类(<stream.Duplex> 的子类)的实例。
¥This event is guaranteed to be passed an instance of the <net.Socket> class, a subclass of <stream.Duplex>, unless the user specifies a socket type other than <net.Socket>.