'unknownProtocol' 事件


当连接的客户端无法协商允许的协议(即 HTTP/2 或 HTTP/1.1)时,则会触发 'unknownProtocol' 事件。 事件句柄接收套接字进行处理。 如果没有为该事件注册监听器,则连接将终止。 可以使用传给 http2.createSecureServer()'unknownProtocolTimeout' 选项指定超时。 请参阅兼容性 API

The 'unknownProtocol' event is emitted when a connecting client fails to negotiate an allowed protocol (i.e. HTTP/2 or HTTP/1.1). The event handler receives the socket for handling. If no listener is registered for this event, the connection is terminated. A timeout may be specified using the 'unknownProtocolTimeout' option passed to http2.createSecureServer(). See the Compatibility API.