Presence Protocol

Channel-based user presence awareness for real-time applications. Know who is online, track join/leave events, and build collaborative experiences.

Who Is Online?

Track connected users across channels for chat rooms, collaborative editing, shared browsing, and multiplayer games.

Real-Time User Awareness

The Presence protocol enables awareness of which users are subscribed to a channel. When a user joins or leaves, all other channel members receive a notification. This is essential for applications that need to display online user lists, typing indicators, active collaborator cursors, or player status in multiplayer games. The protocol supports multiple simultaneous channels per user and provides a full member list on join.

  • Join/leave notifications for all channel members
  • Full member list on channel join
  • Multiple simultaneous channels per user
  • Ideal for chat, collaboration, and gaming
#general Alice Bob Carol

Delphi Presence Example

Join a channel and track other users' presence.

uses
  sgcWebSocket_Client, sgcWebSocket_Types,
  sgcWebSocket_Protocol_Presence_Client;

var
  WSClient: TsgcWebSocketClient;
  PresenceProtocol: TsgcWSPClient_Presence;

procedure TForm1.FormCreate(Sender: TObject);
begin
  WSClient := TsgcWebSocketClient.Create(nil);
  WSClient.Host := 'myserver.example.com';
  WSClient.Port := 443;

  PresenceProtocol := TsgcWSPClient_Presence.Create(nil);
  PresenceProtocol.Client := WSClient;
  PresenceProtocol.OnMemberJoin := OnMemberJoin;
  PresenceProtocol.OnMemberLeave := OnMemberLeave;

  WSClient.Active := True;
end;

procedure TForm1.ButtonJoinClick(Sender: TObject);
begin
  PresenceProtocol.Join('chat-room-1', 'Alice');
end;

procedure TForm1.OnMemberJoin(Sender: TObject;
  const aChannel, aMember: string);
begin
  ListBox1.Items.Add(aMember + ' joined');
end;

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Ready to Add Presence Awareness?

Download the free trial and build collaborative real-time applications.