Heartbeat Sync

The presence heartbeat is a mechanic to signal the system whether a user is online or offline. The SDK offers two convenient methods that allow users to periodically sync or unsync their presence status with the server. When the server receives a heartbeat sync request, it records the timestamp at the time of the request, designating it as the lastHeartbeat timestamp for that user.

The SDK automatically manages the periodic syncing of this heartbeat once the startHeartbeat method is called. To cease syncing your presence with the server, the user must invoke the stopHeartbeat method.

Start Heartbeat

Invoke the startHeartbeat method in client.presence to initiate the heartbeat synchronization process. This method automatically checks the user's presence settings within the network, and if enabled, begins to sync the heartbeat at specified intervals defined in the SDK. The synchronization process is handled automatically, streamlining the user's interaction with the system.

The heartbeat sync interval is determined automatically by SDK. Normally you can except heartbeat to be synced every 20-30 seconds.

Stop Heartbeat

Utilize the stopHeartbeat() method within client.presence to cease the heartbeat synchronization process. To restart the sync, you must invoke the startHeartbeat() method again.

Last updated