Web Meetings SDK | Introduction
This article provides a detailed introduction to the Webex Web SDK meetings
object. It covers multiple methods and events related to meeting creation and retrieval.
anchorThe Meetings Object
anchorThe Meetings
instance is part of the Webex Meetings SDK that contains a list of meetings created using the SDK and APIs to perform specific operations or listen to certain events. A detailed explanation and code examples are provided in this article.
anchorInitialize a Meetings Object
anchorAfter importing and initializing the Web SDK, the Meetings
object is accessible from the webex
object:
const webex = new Webex.init();
const meetings = webex.meetings;
The meetings
constant contains an instance of the Webex Meetings
object.
anchorRegister a Meeting Device
anchorOnce the Meetings
object is instantiated, you can register a device using its register()
method:
const webex = new Webex.init();
await webex.meetings.register();
Asynchronous | Yes |
Parameters | No parameters required |
Returns | Promise<undefined> |
anchorCreate a Meeting
anchorWhen registration has been completed, use the Meetings
object's create()
method to create a new meeting
object:
const meeting = await webex.meetings.create(destination, type);
The create()
method particulars are detailed below:
Asynchronous | Yes | |||||||||||||||
Parameters |
| |||||||||||||||
Returns | Promise<Meeting> |
The Meetings
object returns a meeting
object which can be used to perform actions on the meeting such as mute, unmute, switch audio, etc.
You can also directly create a meeting by using the joinLink
or startLink
parameters, which you can get from the Join a Meeting API response. While using the API, set the createJoinLinkAsWebLink
or createStartLinkAsWeblink
flag as true. Only then will you get the correct link. The link must then be set as the destination.
anchorRetrieve a List of All Meetings
anchorYou can create more than one meeting at a time. To obtain a list of all current meetings, use the Meetings
object's getAllMeetings()
method:
const meetingList = webex.meetings.getAllMeetings();
Asynchronous | No |
Parameters | No parameters required |
Returns | Map<MeetingId,Meeting> |
Here's an example of a returned list of meetings:
{
"3c9628aa-b51d-45c4-9166-1b9f7dafe95e" : { id: "3c9628aa-b51d-45c4-9166-1b9f7dafe95e", ...otherMeetingObjectAttributes },
"c7d69b95-c9c6-40c1-9138-c6005b8be554": { id: "c7d69b95-c9c6-40c1-9138-c6005b8be554", ...otherMeetingObjectAttributesAndMethods },
}
anchorSynchronize Meetings from Webex Cloud
anchorIf your application is running on behalf of a registered Webex user, and that user has meetings running, you can use the Meetings
object's syncMeetings()
method to synchronize and then retrieve a list of those meetings.
await webex.meetings.syncMeetings();
Asynchronous | Yes |
Parameters | No parameters required |
Returns | Promise<undefined> |
After the syncMeetings()
call is successful, use the getAllMeetings
method to retrieve the list of meetings:
await webex.meetings.syncMeetings();
const meetingList = webex.meetings.getAllMeetings();
anchorFetch Meetings by Attribute
anchorYou can narrow down the list of meetings returned by choosing specific meeting attributes via the getMeetingByType()
method.
For instance, to return a meeting whose destination
property is https://cisco.webex.com/meet/alice:
const meeting = webex.meetings.getMeetingByType(
'destination',
'https://cisco.webex.com/meet/alice'
);
The getMeetingByType()
method particulars are detailed below:
Asynchronous | No | ||||||||||||
Parameters |
| ||||||||||||
Returns | Object<Meeting> |
anchorMeetings Ready Event
anchorA meetings:ready
event fires when a meetings
object is ready for use. A meetings
object instance is ready once the containing Webex
object is ready, and all the meetings
object's instance parameters are set. You can subscribe to the ready event immediately following Webex.init
:
webex.meetings.on('meetings:ready',() => {
console.log('Meetings object is ready for device registration');
// Register a new device...
});
The ready event returns no payload.
Make any Meetings object method calls only after receiving this event.
anchorMeetings Registered Event
anchorThe meetings:registered
event is emitted by a Meetings object after you call the register()
method:
webex.meetings.on('meetings:registered',() => {
console.log('Meetings object is ready to perform other operations');
// Perform meeting operations such as create, sync, etc.
});
anchorMeeting is Added Event
anchorThe meeting:added
event fires when a new meeting
object is added to the meetings
object:
webex.meetings.on('meeting:added', ({ type, meeting }) => {
// Perform operations on a specific meeting...
});
This event provides an object with two attributes in its payload:
Sl. No | Attribute Name | Value | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | type |
One of the following:
| ||||||||||||
2 | meeting | The Meeting object itself. |
Meeting is Removed Event
The meeting:removed
event fires when a meeting
object is removed from the meetings
object:
webex.meetings.on('meeting:removed', ({ meetingId, reason }) => {
// Perform operations such as updating the UI to remove the defunct meeting...
});
This event returns an object with two of the following attributes as a payload:
Sl. No | Attribute Name | Value</th> | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | meetingId | The Correlation ID of a meeting | |||||||||||||||||||||
2 | reason |
|
anchorNetwork Disconnected Event
anchorThe network:disconnected
event fires when a meeting instance is disconnected from the Webex Cloud server or when the browser's local network is disconnected:
webex.meetings.on('network:disconnected', () => {
// Perform operations to cleanup the UI that is related to a Meeting Leave
});
Network Connected Event
The network:connected
event fires when the meetings instance is reconnected to the network after being disconnected:
webex.meetings.on('network:connected', () => {
//Perform operations to reconnect Meeting
});