TsgcWSPServer_WebRTC › Events › OnDisconnect
当信令对端关闭其传输或服务器将其断开时,在服务器端触发。
property OnDisconnect: TsgcWSDisconnectEvent;
// TsgcWSDisconnectEvent = procedure(Connection: TsgcWSConnection; Code: Integer) of object
—
Code 携带 WebSocket 关闭代码(1000 正常,1001 离开,1006 异常),或在发生较低层次断开时携带 TCP 错误。处理程序运行前,信令层会更新其订阅表:当 WebRTC.CloseSessionOnHangup 为 True 时,对等方最后一个频道的所有订阅者都会被移除,否则订阅者计数仅减一,以便剩余对等方可以等待重新连接。浏览器之间的实际 WebRTC 媒体连接不受影响,此事件仅涉及信令套接字。
procedure TForm1.WebRTCServerDisconnect(Connection: TsgcWSConnection;
Code: Integer);
begin
Memo1.Lines.Add(Format('peer %s disconnected (code %d)',
[Connection.Guid, Code]));
end;