Messages are delivered asynchronously (“push”) through publish subscribe architecture.
Events to Authorize if a Channel can be created, if a member is allowed...
Every time a new member joins a channel, all members are notified.
By default user is identified by a name, but this can be customized passing more data: email, company, twitter...
// Create websocket client and set server options
oClient := TsgcWebSocketClient.Create(nil);
oClient.Host := 'www.esegece.com';
oClient.Port := 5414;
// Create Presence protocol and assign to websocket client
oPresence := TsgcWSPClient_Presence.Create(nil);
oPresence.Client := oClient;
// Handle Presence methods
oPresence.OnPresenceConnect := OnPresenceConnectHandler;
oPresence.OnPresenceDisconnect := OnPresenceDisconnectHandler;
// connect to server
oClient.Active := True;
// get all connected members
// Subscribe to channel "myTopic"
// Send a message to all subscribers of channel "myTopic"
oPresence.Publish('Text message', 'myTopic');
It is a publish/subscribe protocol with some useful features like: get members connected, who is connected, subscribe to channels, authorizations and more.