TsgcWebSocketServer_HTTPAPIEvents › OnError

OnError Event

Fires whenever a WebSocket protocol error occurs, such as a mal-formed handshake.

Syntax

public event TsgcWSErrorEventHandler OnError;
// delegate void TsgcWSErrorEventHandler(TsgcWSConnection Connection, string Error)

Default Value

Remarks

OnError reports protocol-level problems detected by the WebSocket layer on a client connection, such as a mal-formed handshake, an invalid frame, an unsupported opcode, or an invalid UTF-8 payload when Options.ValidateUTF8 is enabled. The Error parameter contains a textual description and the Connection parameter identifies the offending session. For unhandled runtime exceptions (HTTP.SYS failures, access violations...) the OnException event is raised instead.

Example


void OnError(TsgcWSConnection Connection, string Error)
{
  Console.WriteLine("#error on " + Connection.Guid + ": " + Error);
}

Back to Events