flockMode

  • To enable Follow Me Mode, set the flockMode attribute to true.
  • This will enable Follow Me mode as an option for your Users globally, wherever Presence is shown.
  • To start the shared flock session, click on a User's avatar to start following them.
  • Learn more about it in the Flock Mode feature section.

<VeltPresence flockMode={true} />

Using API:

const presenceElement = client.getPresenceElement();
presenceElement.enableFlockMode();

onNavigate

  • Use a callback for custom navigation or side-effects.
  • When the leader of a Follow Me session navigates, we can use the React Router to update the follower’s position. In the callback you will receive a PageInfo object.
<VeltPresence onNavigate={(pageInfo) => navigate(pageInfo.path)} />

defaultFlockNavigation

  • Disable default Follow Me navigation.
  • Our default navigation uses window.location.href to detect navigation. If you are handling navigation using the callback method above, you should disable our default navigation.
  • Default: true
<VeltPresence defaultFlockNavigation={true} />

startFollowingUser()

  • Start following a user by passing in their user ID.
// Start following the user
presenceElement.startFollowingUser(userId);

stopFollowingUser()

  • Stop following a user.
  • If the current user is in a Follow Me session, they will be removed from that session. If there are no more followers in the session, the session will be destroyed.
// Stop following the user
presenceElement.stopFollowingUser();