事件:'secureConnect'
【Event: '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.】
当使用 new tls.TLSSocket() 构造函数创建 <tls.TLSSocket> 时,不会触发 'secureConnect' 事件。
【The 'secureConnect' event is not emitted when a <tls.TLSSocket> is created
using the new tls.TLSSocket() constructor.】