TsgcWebSocketServer › Events › OnUnknownProtocol
Fires when the first message does not match a known protocol so the connection can be accepted or rejected.
public event TsgcWSUnknownProtocolEventHandler OnUnknownProtocol;
// delegate void TsgcWSUnknownProtocolEventHandler(TsgcWSConnection Connection, out bool Accept)
—
OnUnknownProtocol is raised when the server receives the first bytes from a connecting client and cannot recognize any of the built-in protocols (WebSocket, HTTP, SSE...). It is typically used to accept plain TCP clients. Set Accept to True to keep the session open (OnConnect will then be fired as a plain TCP connection) or to False to close it. The Connection parameter identifies the session; inspect TsgcWSConnection.Transport or the raw bytes already buffered to decide whether to allow the connection.
void OnUnknownProtocol(TsgcWSConnection Connection, ref bool Accept)
{
Accept = true;
}