'secureConnect' 事件


'secureConnect' 事件在新连接的握手过程成功完成后触发。 无论服务器的证书是否被授权,都会调用监听回调。 客户端有责任检查 tlsSocket.authorized 属性以确定服务器证书是否由指定的 CA 之一签名。 如果为 tlsSocket.authorized === false,则可以通过检查 tlsSocket.authorizationError 属性来发现错误。 如果使用了 ALPN,可以检查 tlsSocket.alpnProtocol 属性来确定协商的协议。

The 'secureConnect' event is emitted after the handshaking process for a new connection has successfully completed. The listener callback will be called regardless of whether or not the server's certificate has been authorized. It is the client's responsibility to check the tlsSocket.authorized property to determine if the server certificate was signed by one of the specified CAs. If tlsSocket.authorized === false, then the error can be found by examining the tlsSocket.authorizationError property. If ALPN was used, the tlsSocket.alpnProtocol property can be checked to determine the negotiated protocol.