TsgcWSPServer_WAMP › Events › OnError
当服务器检测到 WAMP 客户端连接上的传输或协议级错误时触发。
property OnError: TsgcWSErrorEvent;
// TsgcWSErrorEvent = procedure(Connection: TsgcWSConnection; const Error: string) of object
—
显示传输级别故障(TLS 协商、套接字重置、异常关闭)和 WAMP 解码器针对传入帧引发的协议级异常(未知消息 ID、格式错误的 JSON)。Error 字符串是供日志记录使用的人类可读描述。RPC 中应用程序代码产生的错误通过 CallError 报告给调用方,而不在此处报告。使用 OnException 处理用户事件处理程序内部引发的 Delphi 异常。
procedure TForm1.WAMPServerError(Connection: TsgcWSConnection;
const Error: string);
begin
Memo1.Lines.Add(Format('[%s] error: %s', [Connection.Guid, Error]));
end;