Publish subscribe architecture

Messages are delivered asynchronously (“push”) through publish subscribe architecture.

Agnostic

A messaging transport that is agnostic to the content of the payload.

Quality of Service (QoS)

Three QoS for message delivery could be achieved using SGC

Transactional

Supports transactional messages through server local transactions. When the client commits the transaction, the server processes all messages queued. If client rollback the transaction, then all messages are deleted.

Create Connection

// Create websocket client and set server options
oClient := TsgcWebSocketClient.Create(nil);
oClient.Host := 'www.esegece.com';
oClient.Port := 5414;

// Create SGC protocol and assign to websocket client
oSGC := TsgcWSPClient_sgc.Create(nil);
oSGC.Client := oClient;


// Handle SGC methods
oSGC.OnSGCConnect := OnSGCConnectHandler;
oSGC.OnSGCDisconnect := OnSGCDisconnectHandler;

// connect to server
oClient.Active := True;

Commit Transaction

// Apply Changes of "myTransaction"
oSGC.Commit('myTransaction');

Subscribe

// Subscribe to channel "myTopic"
oSGC.Subscribe('myTopic', 'Text message');

Publish

// Send a message to all subscribers of channel "myTopic"
oSGC.Publish('myTopic', 'Text message');

It is a publish/subscribe protocol with some useful features like: transactions, Quality Of Service, RPC, Acknowledgments and more.

Protocol
SGC
Default eSeGeCe WebSockets Protocol