TsgcWebSocketClient属性 › Active

Active 属性

打开或关闭到已配置服务器的 WebSocket 连接。

语法

property Active: Boolean read GetActive write SetActive default False;

默认值

False

备注

Active 设为 True 以使用当前的 HostPortTLSURL 设置启动新的 WebSocket 连接。将属性设回 False 则优雅地关闭连接。使用 Active(而不是低级的 Connected 方法)检查客户端是否有打开的会话;Active 更安全,因为它不会调用 Indy 内部的 connected 例程,该例程可能会锁定线程。

示例


oClient := TsgcWebSocketClient.Create(nil);
oClient.URL := 'wss://www.esegece.com:2053';
oClient.Active := true;

返回属性