Messages are delivered asynchronously (“push”) through publish subscribe architecture.
A messaging transport that is agnostic to the content of the payload.
Three QoS for message delivery could be achieved using SGC
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 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;
// Apply Changes of "myTransaction"
oSGC.Commit('myTransaction');
// Subscribe to channel "myTopic"
oSGC.Subscribe('myTopic', 'Text message');
// 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.