TsgcWebSocketServer › Gebeurtenissen › OnTCPConnect
Wordt geactiveerd nadat een client verbinding maakt op TCP-niveau en vóór de WebSocket-handshake, zodat de verbinding kan worden geaccepteerd of geweigerd.
property OnTCPConnect: TsgcWSOnTCPConnect;
// TsgcWSOnTCPConnect = procedure(Connection: TsgcWSConnection; var Accept: Boolean) of object
—
OnTCPConnect is called AFTER the TCP verbinding is geaccepteerd and BEFORE the WebSocket handshake. It is nuttig when de server accepts plain TCP connections: standaard OnConnect is only fired after the eerste message is received from de client, so handle deze gebeurtenis and set Verbinding.Transport to trpTCP to treat de client as a raw TCP peer from the start. Set Accept to False to reject the verbinding onmiddellijk; leave it True (de standaardwaarde) to let de server proceed with protocol detection or the WebSocket handshake.
procedure OnTCPConnectEvent(aConnection: TsgcWSConnection; var Accept: Boolean);
begin
aConnection.Transport := trpTCP;
Accept := True;
end;