TsgcWSPServer_sgc › Events › OnConnect
Fires after a client completes the WebSocket handshake for this subprotocol.
property OnConnect: TsgcWSConnectEvent;
// TsgcWSConnectEvent = procedure(Connection: TsgcWSConnection) of object
—
Raised once per accepted connection after the subprotocol sends its session identifier and drains any queued retained publications. When a Broker is assigned the event is suppressed so the broker pipeline can own the handshake; otherwise this is the right place to inspect Connection.Guid, Connection.PeerIP or custom headers attached by the HTTP upgrade.
procedure TForm1.oProtocolConnect(Connection: TsgcWSConnection);
begin
Memo1.Lines.Add('connected: ' + Connection.Guid);
end;