SGC Protocol
A JSON-RPC 2.0 based custom protocol providing remote procedure calls, publish-subscribe messaging, transactional operations, QoS, and message acknowledgment.
A JSON-RPC 2.0 based custom protocol providing remote procedure calls, publish-subscribe messaging, transactional operations, QoS, and message acknowledgment.
A versatile messaging protocol built on JSON-RPC 2.0 that adds structured communication patterns to WebSocket connections.
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.
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;
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.