TsgcWSPClient_sgc事件 › OnDisconnect

OnDisconnect 事件

连接关闭时触发,报告关闭代码。

语法

property OnDisconnect: TsgcWSDisconnectEvent;
// TsgcWSDisconnectEvent = procedure(Connection: TsgcWSConnection; Code: Integer) of object

默认值

备注

当客户端断开连接或服务器关闭会话时触发。Code 是 WebSocket 关闭状态码(例如正常关闭为 1000)。此处理程序触发之前,QoS 定时器和 RPC 列表将被清除。

示例

procedure TForm1.oProtocolDisconnect(Connection: TsgcWSConnection; Code: Integer);
begin
  Memo1.Lines.Add(Format('disconnected: %d', [Code]));
end;

返回事件