You can pass a function to the onJoinCall
, onMemberJoin
, onMemberLeave
or onLeaveCall
props to trigger on those particular events. For example, console.log("call ended")
triggers by default for onLeaveCall
.
You can also pass any kind of encoded stringified data through Catalyst from one member to another. For example, if you need to transmit some form of metadata between members of a call without setting up your own servers. This is particularly useful for synchronizing state or triggering custom events.
This can be done with a combination of the arbData
and handleReceiveArbData
props:
Simply encode your stringified data (optionally JSON) to Uint8Array
and pass it to the arbData
prop. Catalyst will send it to each other member in the call, triggering their respective handleReceiveArbData
functions. In the example above, that simply triggers a console log, but you can accomplish almost anything.
Catalyst offers a handleUserData
method to access the internal metadata of a particular user, triggered when their token is generated to join a session.
A JSON object in the following format is passed:
An example of a component accessing this data is shown below: