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), Objective-C 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 Objective-C 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
[subscription fetchPresence:YES
callback:^(NSArray<NSString *> *users) {
NSLog(@"Active users: %@", users);
}
completion:^(PresenceUnsubscribe unsubscribe, NSError *error) {

if (error) {
NSLog(@"Presence error: %@", error);
return;
}

}];
important

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

To learn more about Channel creation, click here.