Protocol
Presence
Presence eSeGeCe WebSockets Protocol

Publish subscribe architecture

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

Authorizations

Events to Authorize if a Channel can be created, if a member is allowed...

Messages

Every time a new member joins a channel, all members are notified.

Identification

By default user is identified by a name, but this can be customized passing more data: email, company, twitter...

Create Connection

// 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 Members

// get all connected members
oPresence.GetMembers;

Subscribe

// Subscribe to channel "myTopic"
oPresence.Subscribe('myTopic');

Publish

// 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.