Skip to main content
SecureContextOptions.ALPNCallback - tls - Node documentation
property SecureContextOptions.ALPNCallback

Usage in Deno

import { type SecureContextOptions } from "node:tls";

If set, this will be called when a client opens a connection using the ALPN extension. One argument will be passed to the callback: an object containing servername and protocols fields, respectively containing the server name from the SNI extension (if any) and an array of ALPN protocol name strings. The callback must return either one of the strings listed in protocols, which will be returned to the client as the selected ALPN protocol, or undefined, to reject the connection with a fatal alert. If a string is returned that does not match one of the client's ALPN protocols, an error will be thrown. This option cannot be used with the ALPNProtocols option, and setting both options will throw an error.

Type

((arg: { servername: string; protocols: string[]; }) => string | undefined) | undefined