SDK v7.x · Last verified March 2026 · iOS · Android · Web · Flutter
Speed run — just the code
Speed run — just the code
Prerequisites: SDK installed and authenticated → SDK Setup. Presence features must be enabled for your network — check Admin Console → Settings.
After completing this guide you’ll have:
- Online/offline presence indicators on user avatars throughout the app
- Channel-level presence (who is currently viewing a community or room)
- Real-time event subscriptions for platform-wide activity tracking
Quick Start: Enable User Presence
TypeScript
Part 1: User Presence (Online/Offline)
Enable presence and start heartbeat
Enable presence tracking for the current user and start the automatic heartbeat. The SDK sends a heartbeat every 20-30 seconds to keep the user’s online status current.Full reference → Heartbeat Sync
TypeScript
Query user presence
Check whether specific users are online. Query up to 220 users at once for a member list or chat contact screen.Full reference → User Presence
TypeScript
Sync presence for real-time updates
For users visible on screen (profile page, chat list), sync their presence to get live updates when they come online or go offline. Max 20 synced users at a time.Full reference → User Presence
TypeScript
Get online users count
Display a global “X users online” counter for your platform.Full reference → User Presence
TypeScript
Handle app lifecycle
Stop the heartbeat when the app goes to the background and restart it when the app returns to the foreground. This prevents false “online” status while the app is minimized.Full reference → Heartbeat Sync
TypeScript
Part 2: Channel Presence
Sync channel presence
Track which channels have active members. Useful for chat lists showing “2 members active” or highlighting active communities.Full reference → Channel Presence
TypeScript
Manage visible channels
Sync/unsync channels as the user scrolls through a chat list. Max 20 synced channels at a time.Full reference → Channel Presence
TypeScript
Part 3: Real-time Social Event Subscriptions
Beyond presence, you can subscribe to content events — new posts, comments, reactions — so your UI updates instantly without polling.Subscribe to community events
Subscribe at different granularity levels: community-level, post-level, or comment-level.Full reference → Social Real-time Events
TypeScript
Subscribe to post and comment events
For a post detail screen, subscribe to comment-level events on a specific post.Full reference → Social Real-time Events
TypeScript
Subscribe to follow events
Get real-time updates when someone follows or unfollows the current user.Full reference → Social Real-time Events
TypeScript
Connect to Moderation & Analytics
Presence analytics
Presence analytics
Track daily active concurrent users and peak online times in Admin Console → Analytics Dashboard. This helps with capacity planning and understanding peak engagement windows.
Admin Console: presence settings
Admin Console: presence settings
Enable or disable presence features for your network in Admin Console → Settings. Presence can be toggled per-network without code changes.
Webhook: real-time event triggers
Webhook: real-time event triggers
Combine SDK real-time events with webhook events for server-side workflows. For example, subscribe to
post.created in the SDK for instant UI updates, and also handle it via webhook for server-side indexing.→ Webhook EventsCommon Mistakes
Best Practices
Presence UX
Presence UX
- Use a green dot for “online”, grey dot for “offline”, and show “Last seen X min ago” for recently active users
- Don’t show exact “last seen” timestamps for privacy — round to “a few minutes ago”, “an hour ago”, etc.
- Let users opt out of showing their online status in profile settings
- Combine presence with typing indicators in chat for a “User is typing…” experience
Performance
Performance
- Respect the 20-user sync limit — sync only users currently visible on screen
- Unsync users/channels as they scroll off screen; re-sync when they scroll back
- Use
getUserPresence()for one-time queries (member lists); usesyncUserPresence()only for screens that need live updates - Stop heartbeat in background to avoid battery drain on mobile
- Use
viewIdwhen the same user is displayed in multiple UI components to avoid duplicate unsubscriptions
Real-time event subscriptions
Real-time event subscriptions
- Subscribe at the highest useful level: one
getCommunityTopic(community, POST_AND_COMMENT)subscription is better than separate post + comment subscriptions - Unsubscribe when the component/screen unmounts — don’t leak subscriptions
- Use real-time events for UI updates; use webhooks for server-side workflows
- Don’t subscribe to everything globally — only subscribe to topics the user is actively viewing
Next Steps
Your next step → Notifications & Engagement
Presence is live — now pair it with push notifications to keep users informed across sessions.
Build a Social Feed
Use Live Collections for real-time feed updates
Notifications & Engagement
Combine presence with notification delivery
User Profiles & Social Graph
Show online status on user profiles