SGC Protocol

A JSON-RPC 2.0 based custom protocol providing remote procedure calls, publish-subscribe messaging, transactional operations, QoS, and message acknowledgment.

What is the SGC Protocol?

A versatile messaging protocol built on JSON-RPC 2.0 that adds structured communication patterns to WebSocket connections.

Structured Messaging Over WebSocket

The SGC protocol uses JSON-RPC 2.0 as its message format, providing a standardized way to make remote procedure calls and exchange structured data over WebSocket connections. It supports multiple communication patterns including request-response RPC, publish-subscribe, and broadcast messaging. Built-in QoS levels and message acknowledgment ensure reliable delivery for critical applications.

  • JSON-RPC 2.0 message format
  • RPC, Publish-Subscribe, and Broadcast patterns
  • Three QoS levels for delivery guarantees
  • Transactional messaging with commit/rollback
JSON-RPC 2.0 {"method":"rpc","params":{}} PUB/SUB RPC

Delphi SGC Protocol Example

Use the SGC protocol for publish-subscribe messaging.

uses
  sgcWebSocket_Client, sgcWebSocket_Types,
  sgcWebSocket_Protocol_sgc_Client;

var
  WSClient: TsgcWebSocketClient;
  SGCProtocol: TsgcWSPClient_sgc;

procedure TForm1.FormCreate(Sender: TObject);
begin
  WSClient := TsgcWebSocketClient.Create(nil);
  WSClient.Host := 'myserver.example.com';
  WSClient.Port := 443;

  SGCProtocol := TsgcWSPClient_sgc.Create(nil);
  SGCProtocol.Client := WSClient;
  SGCProtocol.OnMessage := OnSGCMessage;
  SGCProtocol.OnRPC := OnSGCRPC;

  WSClient.Active := True;
end;

procedure TForm1.ButtonSubscribeClick(Sender: TObject);
begin
  // Subscribe to a channel
  SGCProtocol.Subscribe('news');
end;

procedure TForm1.ButtonPublishClick(Sender: TObject);
begin
  // Publish a message to all subscribers
  SGCProtocol.Publish('news',
    'Breaking: new release available!');
end;

Documentation & Demos

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

Ready to Use the SGC Protocol?

Download the free trial and start building with JSON-RPC messaging.