Permalink features
For the Permalink API there are some helper methods to easily integrate permalink in any Custom UI with EyesonJS.
Available since version 1.9.3
Join as host user
Instead of eyeson.connect(<access-key>)
the connectPermalink()
function exists.
This will resolve the permalink user-token and start the meeting.
import eyeson from "eyeson";
eyeson.onEvent(event => {
if (event.type === 'permalink_ready') {
console.log('Permalink is resolved and meeting is started');
}
if (event.connectionStatus === 'connected') {
eyeson.join({ audio: true, video: true });
}
});
eyeson.connectPermalink(userToken);
See more about the eyeson.connect()
function.
Join as guest
Guest users will have to wait until the meeting is up and running
import eyeson from "eyeson";
eyeson.onEvent(event => {
if (event.type === 'error') {
if (event.content.includes('expired')) {
// permalink expired
}
}
if (event.type === 'permalink_meeting_info') {
if (event.room.started_at === null) {
// need to wait
}
else {
// allow join, for example enable join button
}
}
if (event.type === 'guest_user') {
// "event.token" is the user's actual access_key for eyeson.start()
}
});
// for example invoke when join button is pressed
const onJoin = () => {
eyeson.send({
type: 'request_guest_user',
api: eyeson.config.api,
name: '<user name>',
token, // permalink guest-token
locale,
});
};
eyeson.send({
type: 'request_permalink_meeting_info',
api: eyeson.config.api, // set api as Eyeson is not yet initialized
token, // permalink guest-token
});
info
Good to know: The request_permalink_meeting_info
will poll every 5 seconds,
so that the permalink_meeting_info
event is invoked multiple times until the meeting is running.