TsgcWebSocketHTTPServerEvents › OnSSLALPNSelect

OnSSLALPNSelect Event

Fires during an ALPN-enabled handshake so the application can pick which protocol to negotiate.

Syntax

public event TsgcWSOnSSLALPNSelectHandler OnSSLALPNSelect;
// delegate void TsgcWSOnSSLALPNSelectHandler(TObject Sender, TStringList aProtocols, out string aProtocol)

Default Value

Remarks

When a client advertises Application-Layer Protocol Negotiation during the TLS handshake, OnSSLALPNSelect is raised so the server can decide which protocol to negotiate. The aProtocols parameter is a TStringList with the names advertised by the client (for example "h2", "http/1.1"); assign aProtocol to the one that the server wants to use. When HTTP2Options.Enabled is True the component returns "h2" by default so HTTP/2 is negotiated transparently; override the selection here if the server wants to force HTTP/1.1 or a custom protocol. Returning an empty string leaves the default behaviour in place.

Example

Back to Events