setUserData()
setUserData(data)
Allows you to associate custom data with the local participant and share that with other participants. The data is stored in the userData
property in the DailyParticipant
object corresponding to the local participant and will replace any value already there.
A participant can only set their own local data. They cannot set other participants’ user data.
userData
is an optional field on a DailyParticipant
and defaults to not existing. You can remove the field from the object at any time by setting the data back to undefined
(i.e. setUserData(undefined)
);
The data
argument should be an object that:
- is serializable to JSON
- has a max payload size of 4KB
Returns a Promise which resolves to the userData
that was set.
Calls to setUserData()
are rate limited. All calls will update the local copy of userData
immediately. However,
synchronization across participants is rate limited, with assurance that all participants end with the same
userData
value.
You can access userData
on a participant via participants()
:
For more information, see the participants()
method.