The Member API provides methods to interact with members in the current space.
Members represent users connected to the space. You can retrieve information about members,
manage custom data associated with them, and perform actions on them.
Every member has an ID, which is a continuous number starting from 0. The local member (the user of the current client)
always has the ID 0. Other members are assigned IDs in the order they join the space.
Quick Start
// Get the webvis contextconstcontext = awaitwebvis.getContext();// Get the IDs of all members in the current spaceconstmemberIds = context.getMembers();// Request properties for the local member, which always has ID 0constlocalMemberProps = awaitcontext.requestMemberProperties(0);// Request properties for another memberconstotherMemberProps = awaitcontext.requestMemberProperties(1);// Set/get the name of the local membercontext.setMemberName("John Doe");constmemberName = context.getMemberName();
Custom member data
You can manage custom data at the profile entries of a member using the
setMemberProfileEntry and deleteMemberProfileEntry methods. This data
is stored in the profile field of the MemberProperties object and will be
available to other members in the same space.
// Set/get custom data at the profile entries of the local memberawaitcontext.setMemberProfileEntry("status", "online");awaitcontext.setMemberProfileEntry("age", 30);conststatus = localMemberProps.profile["status"]; // "online"constage = localMemberProps.profile["age"]; // 30// Delete a profile entry of the local memberawaitcontext.deleteMemberProfileEntry("age");
Member actions
You can request and use actions available on a member using the
requestMemberActions and useMemberAction methods. Member actions
allow you to perform predefined operations on members, see MemberAction
for a list of available actions.
// Request available actions on another memberconstactions = awaitcontext.requestMemberActions(1);// Use an action on another memberif (actions.includes(webvis.MemberAction.PROMOTE)) {awaitcontext.useMemberAction(1, webvis.MemberAction.PROMOTE);}
Member API
Overview
The Member API provides methods to interact with members in the current space. Members represent users connected to the space. You can retrieve information about members, manage custom data associated with them, and perform actions on them.
Every member has an ID, which is a continuous number starting from 0. The local member (the user of the current client) always has the ID 0. Other members are assigned IDs in the order they join the space.
Quick Start
Custom member data
You can manage custom data at the profile entries of a member using the
setMemberProfileEntryanddeleteMemberProfileEntrymethods. This data is stored in theprofilefield of the MemberProperties object and will be available to other members in the same space.Member actions
You can request and use actions available on a member using the
requestMemberActionsanduseMemberActionmethods. Member actions allow you to perform predefined operations on members, see MemberAction for a list of available actions.Events
The Member API emits the following events: