TsgcWSPServer_WAMPEvents › OnPrefix

OnPrefix Event

Fires when a client sends a PREFIX frame, registering a shortcut (CURIE) that expands to a full URI.

Syntax

property OnPrefix: TsgcWSPrefixEvent;
// TsgcWSPrefixEvent = procedure(Connection: TsgcWSConnection; const Prefix, URI: string) of object

Default Value

Remarks

WAMP v1 lets a client abbreviate long procedure and topic URIs using PREFIX messages. Whenever the broker receives one it stores the mapping on the session so subsequent SUBSCRIBE, PUBLISH and CALL frames for that client can use the Prefix shortcut in place of URI. The event is informational — the mapping is already active when the handler runs. Use it to audit namespaces a client announces, to validate that only known prefixes are accepted, or to trigger server-side PUBLISH policies keyed off the URI.

Example


procedure TForm1.WAMPServerPrefix(Connection: TsgcWSConnection;
  const Prefix, URI: string);
begin
  Memo1.Lines.Add(Format('[%s] PREFIX %s = %s',
    [Connection.Guid, Prefix, URI]));
end;

Back to Events