diff --git a/doc/api/tls.md b/doc/api/tls.md index 95335e6f275099..54bfa39cdd5d0b 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -741,12 +741,9 @@ server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` is set to describe how authorization failed. Depending on the settings of the TLS server, unauthorized connections may still be accepted. -The `tlsSocket.alpnProtocol` property is a string that contains the selected -ALPN protocol. When ALPN has no selected protocol because the client or the -server did not send an ALPN extension, `tlsSocket.alpnProtocol` equals `false`. - -The `tlsSocket.servername` property is a string containing the server name -requested via SNI. +The [`tls.TLSSocket.servername`][] and [`tls.TLSSocket.alpnProtocol`][] +properties can be used to check which server name was requested, and which +protocol was negotiated. ### Event: `'tlsClientError'` @@ -1043,6 +1040,18 @@ Returns the bound `address`, the address `family` name, and `port` of the underlying socket as reported by the operating system: `{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. +### `tlsSocket.alpnProtocol` + + + +* Type: {string|boolean|null} + +The negotiated ALPN protocol. This is `null` before the handshake completes. +Once the handshake completes, it settles as either the negotiated protocol +name, or `false` if the peers did not negotiate an ALPN protocol. + ### `tlsSocket.authorizationError` + +* Type: {string|boolean|null} + +The SNI (Server Name Indication) host name associated with the socket. This is +`null` before the handshake completes. Once the handshake completes it settles +as either the host name string, or `false` if SNI was not used. + ### `tlsSocket.setKeyCert(context)`