TsgcWebSocketServer_HTTPAPI › Events › OnHandshake
Fires after the handshake is evaluated on the server side and before the response is sent.
public event TsgcWSHandshakeEventHandler OnHandshake;
// delegate void TsgcWSHandshakeEventHandler(TsgcWSConnection Connection, out TStringList Headers)
—
OnHandshake is raised on the server immediately after a client's HTTP upgrade request has been parsed by HTTP.SYS and validated, and before the handshake response is written back. The incoming headers sent by the client are available through the HeadersRequest property of the connection (cast to TsgcWSConnection_HTTPAPI). The Headers parameter is a TStringList containing the response lines that will be returned; add custom lines (for example a vendor-specific header) to include them in the HTTP response. Standard WebSocket headers (Upgrade, Connection, Sec-WebSocket-Accept...) are already populated and should not be duplicated.
void OnServerHandshake(TsgcWSConnection Connection, TStringList Headers)
{
MessageBox.Show(Headers.Text);
}