Custom Protocols

Built-in custom protocols that extend WebSocket with RPC, file transfers, dataset synchronization, presence awareness, and end-to-end encryption.

Beyond Standard WebSocket

sgcWebSockets includes several custom protocols that add high-level functionality on top of WebSocket connections.

SGC Protocol

JSON-RPC 2.0 based protocol supporting RPC calls, publish-subscribe, transactional messages, QoS, and message acknowledgment.

Files Protocol

Binary WebSocket transport for transferring files between connected clients with configurable packet sizes, authorization, and QoS.

Dataset Protocol

Broadcast dataset modifications across multiple connected clients for real-time data synchronization.

Presence Protocol

Channel-based user presence awareness for chat, collaboration, shared browsing, and multiplayer applications.

E2EE Protocol

End-to-end encryption protocol ensuring messages are encrypted on the sender and decrypted only by the intended recipient.

SGC Protocol Quick Start

The SGC protocol is the most versatile custom protocol, supporting RPC and pub-sub patterns.

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;

  WSClient.Active := True;
end;

procedure TForm1.OnSGCMessage(Connection: TsgcWSConnection;
  const aMessage: string);
begin
  Memo1.Lines.Add('Received: ' + aMessage);
end;

Ready to Explore Custom Protocols?

Download the free trial and start building with built-in protocol support.