TsgcWebSocketClientProperties › TLSOptions

TLSOptions Property

Configures certificates, TLS version, ALPN, IOHandler and other secure-connection details used when TLS is enabled.

Syntax

property TLSOptions: TsgcWSTLS_Options read FTLSOptions write SetTLSOptions;

Default Value

Preset=tlspCustom

Remarks

Accessible only when TLS is True. Sub-properties include RootCertFile, CertFile, KeyFile, Password, VerifyCertificate, VerifyDepth, Version (from tlsUndefined through tls1_3), ALPNProtocols and IOHandler (iohOpenSSL, iohSChannel, iohAndroidTLS or iohAppleTLS). On Android, iohAndroidTLS uses the platform native TLS (javax.net.ssl.SSLEngine) and on iOS and macOS, iohAppleTLS uses Apple native TLS, so no OpenSSL libraries need to be deployed; native platform TLS requires the Enterprise edition. OpenSSL-specific settings live under OpenSSL_Options and SChannel-specific settings under SChannel_Options.

Preset applies a set of secure defaults in a single assignment. With tlspCustom (default) every option keeps the value you configure manually, preserving the previous behaviour. Setting Preset := tlspSecureDefaults enables certificate verification (VerifyCertificate := True), raises Version to at least TLS 1.2 (when a lower or undefined version was configured) and enables hostname checking of the server certificate (OpenSSL X509Checks hostname validation). Individual options can still be adjusted after applying the preset.

Example


oClient := TsgcWebSocketClient.Create(nil);
oClient.URL := 'wss://www.esegece.com:2053';
oClient.TLSOptions.Version := tls1_2;
oClient.TLSOptions.VerifyCertificate := true;
oClient.TLSOptions.RootCertFile := 'cacert.pem';
oClient.Active := true;

Back to Properties