Skip to main content
A heartbeat tells social.plus that the current user is still active. There are two heartbeat surfaces:
  • Current user heartbeat marks the logged-in user online for user and channel presence. It is available on iOS and Android.
  • Room heartbeat marks the current user as present in a live room. It is available on iOS, Android, and TypeScript.
Heartbeat intervals are controlled by server-side presence settings. The SDK sends the first heartbeat immediately, then continues on the configured cadence.

Platform Surface

Parameters

Start the Current User Heartbeat

Use this when your app wants the current user to appear online in user and channel presence.

Start a Room Heartbeat

Use room heartbeat only while the current user is watching or participating in a live room.

Lifecycle Guidance

Start the current user heartbeat after login when the app wants the user to appear online. Start room heartbeat only while the room screen is visible and the user should count as a viewer.
Stop heartbeat when the user logs out, leaves the room, dismisses the screen, or your view model is deallocated. For mobile apps, also stop or pause room heartbeat when the room screen backgrounds.
If presence is disabled for the network, heartbeat start calls can fail. Treat that as a configuration error and hide online-state UI instead of retrying forever.

User Presence

Read and sync user online state after the current user heartbeat is active.

Room Presence

Read live room viewer counts and online room users.