TsgcWSPServer_WAMP › Events › OnConnect
Fires on the server side when a WebSocket client finishes the handshake and attaches to the WAMP sub-protocol.
property OnConnect: TsgcWSConnectEvent;
// TsgcWSConnectEvent = procedure(Connection: TsgcWSConnection) of object
—
Raised once per client immediately after the underlying TsgcWebSocketServer accepts the upgrade and routes the connection to this protocol handler. At this point the component has already sent the WAMP WELCOME frame with its Guid session id and Version string, so any server-side pre-registration of prefixes or subscriptions for that client is safe to perform here. Use Connection to store per-client state (peer IP, authentication token extracted from headers, etc.).
procedure TForm1.WAMPServerConnect(Connection: TsgcWSConnection);
begin
Memo1.Lines.Add(Format('client %s connected from %s',
[Connection.Guid, Connection.PeerIP]));
end;