TsgcWebSocketHTTPServer属性 › SSL

SSL 属性

在服务器上启用 TLS/SSL,以便客户端可以使用 wss://https:// 进行连接。

语法

property SSL: Boolean read FSSL write FSSL default False;

默认值

False

备注

SSL 设置为 True 以接受安全连接。您还必须在 SSLOptions 中配置证书材料(CertFileKeyFileRootCertFilePassword),并将 SSLOptions.Port 设置为 TLS 端口。同一服务器可以通过添加多个 Bindings 条目并保持 SSL=True 来同时服务明文和加密端点;服务器仅将 TLS 处理程序自动附加到安全端口。证书必须以 PEM 格式提供。

示例


oServer := TsgcWebSocketHTTPServer.Create(nil);
oServer.SSL := true;
oServer.SSLOptions.CertFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.KeyFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.RootCertFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.Port := 443;
oServer.Port := 443;
oServer.Active := true;

返回属性