Presence Service

The Presence service lets you check whether a user is currently online and when they were last seen.

// Access via client
final presence = client.presence;

Methods

get

Retrieve the online status and last seen timestamp for a user.

Signature

Future<Map<String, dynamic>> get([String? user])

Parameters

Parameter

Type

Description

user

String?

NX identifier of the user to check. If omitted, returns the current user’s presence.

Returns

A map containing:

Field

Description

online

true if the user is currently connected

last_seen

ISO 8601 timestamp of the user’s last activity

status

Optional status message set by the user

Example

// Check another user's presence
final result = await client.presence.get(
  'user@nxservice.quantumvision-tech.com',
);
print(result['online']);     // true or false
print(result['last_seen']);  // 2024-01-15T10:30:00Z

// Check your own presence
final myPresence = await client.presence.get();
print(myPresence['status']);