Skip to main content

User Presence

ART provides a robust User Presence feature that delivers real-time insights into user activity across all channels. Leveraging the Aiotrix Development Toolkit (ADK), Swift developers can quickly determine who is online at any given moment within a channel.

This feature continuously updates the presence list, enabling your application to listen for these updates and trigger specific functionalities based on a user's online status. With User Presence, applications gain enhanced visibility into user activity, which can be leveraged for numerous real-time functions.

How It Works?

ART's User Presence feature operates by maintaining a dynamic list of active users within each channel. When a user connects or disconnects, their presence status is immediately updated. Your application, utilizing the Swift ADK, can subscribe to these presence updates. This allows you to receive notifications in real-time as users come online, go offline, or change their status, enabling your application to react and update its interface or logic accordingly.

The fetchPresence() method provides real-time presence information by invoking a callback with the current list of connected users each time the list changes.

// Listen for active users in the channel
try await subscription.fetchPresence { users in
print("Active users:", users)
}
important

To track user presence in a channel, enable presence tracking while creating the channel.

To learn more about Channel creation, click here.