TsgcWebSocketProxyServer › Events › OnHandshake
Wordt geactiveerd nadat de handshake met een downstream-client is geëvalueerd en voordat het antwoord wordt verzonden.
property OnHandshake: TsgcWSHandshakeEvent;
// TsgcWSHandshakeEvent = procedure(Connection: TsgcWSConnection; var Headers: TStringList) of object
—
OnHandshake is raised onmiddellijk after a stroomafwaarts client's HTTP upgrade request has been parsed and validated, and before the handshake response is written back. The inkomend headers sent by de client are beschikbaar through the HeadersRequest property of the verbinding (cast to TsgcWSConnectionServer). The Headers parameter is a TStringList containing de reactie lines that will be returned; add aangepast lines (bijvoorbeeld a vendor-specifiek header) to include them in the HTTP response. Standard WebSocket headers (Upgrade, Verbinding, Sec-WebSocket-Accept...) are already populated and should not be duplicated. Deze gebeurtenis applies to the stroomafwaarts WebSocket leg only; the proxy does not perform a WebSocket handshake against the stroomopwaarts TCP server.
procedure OnServerHandshake(Connection: TsgcWSConnection; var Headers: TStringList);
begin
ShowMessage(TsgcWSConnectionServer(Connection).HeadersRequest.Text);
end;