WAMP Protocol

Web Application Messaging Protocol — unified Remote Procedure Calls (RPC) and Publish/Subscribe (PubSub) in a single protocol over WebSocket.

TsgcWSPClient_WAMP

WAMP v1 subprotocol client — PubSub plus typed Remote Procedure Calls over WebSocket. The WAMP2 router-side variant lives in TsgcWSPClient_WAMP2.

Component class

TsgcWSPClient_WAMP

Protocol

WAMP v1 (PubSub + RPC)

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Professional / Enterprise

Drop the component, set a few properties, go

Pair with a TsgcWebSocketClient, hook OnWelcome, then Prefix / Subscribe / Publish / Call.

uses
  sgcWebSocket, sgcWebSocket_Protocol_WAMP_Client;

var
  WSClient: TsgcWebSocketClient;
  WAMP: TsgcWSPClient_WAMP;
begin
  WSClient := TsgcWebSocketClient.Create(nil);
  WSClient.Host := 'router.example.com';
  WSClient.Port := 8080;

  WAMP := TsgcWSPClient_WAMP.Create(nil);
  WAMP.Client := WSClient;

  WAMP.OnWelcome    := WAMPWelcome;
  WAMP.OnEvent      := WAMPEvent;
  WAMP.OnCallResult := WAMPCallResult;

  WSClient.Active := True;
end;

procedure TForm1.WAMPWelcome(Connection: TsgcWSConnection;
  SessionId, ProtocolVersion, ServerIdent: string);
begin
  WAMP.Prefix('app', 'http://example.com/');
  WAMP.Subscribe('app:news');
  WAMP.Publish('app:news', 'hello');
  WAMP.Call('call-1', 'app:rpc', '{"x":1}');
end;

procedure TForm1.WAMPEvent(Connection: TsgcWSConnection;
  TopicURI, Event: string);
begin
  Memo1.Lines.Add(TopicURI + ': ' + Event);
end;

What's inside

3 published properties, 7 methods, 13 events — pulled from the component reference.

Connection

Published properties: Client, Broker.

Messaging

Events: OnMessage, OnBinary, OnFragmented.

Lifecycle

Events: OnConnect, OnDisconnect, OnWelcome.

Advanced

Methods: WriteData.

Diagnostics

Published properties: Version.

PubSub

Methods: Prefix, Subscribe, UnSubscribe.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — Protocol_WAMP Full property, method and event reference for this component.
Demo Project — Demos\Protocols\WAMP Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi, C++ Builder and .NET and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Get Started with WAMP?

Download the free trial and build real-time applications with unified RPC and PubSub.