Skip to content

Introduction to Webex Meetings

Parimala032 edited this page Aug 6, 2024 · 12 revisions

Caution

This documentation may no longer be current. Click here to view the updated content on our Developer Portal.

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.

The Meetings Object

The 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.

Initialize a Meetings Object

After 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.

Register a Meeting Device

Once 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>

Create a Meeting

When 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
Sl. No Parameter Name Parameter Type Mandatory Description
1 destination String Yes The meeting destination where the meeting will take place. There are several possible types of destinations as described in the type parameter.
2 type String No The meeting type must be one of the following:
  • MEETING_LINK
  • SIP_URI
  • CONVERSATION_URL
  • PERSONAL_ROOM
  • MEETING_LINK
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.

Retrieve a List of All Meetings

You 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 },
}

Synchronize Meetings from Webex Cloud

If 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();

Fetch Meetings by Attribute

You 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
Name Description Type Mandatory
attrib The attribute of the meeting you'd like to retrieve, for instance, correlationId, destination, meetingLink. String Yes
value The value to be matched for the attribute. String Yes
Returns Object<Meeting>

Meetings Ready Event

A 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.

Meetings Registered Event

The 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.
});

Meeting is Added Event

The 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:
Sl. No Type Description
1 CREATED The meeting was created from within the SDK.
2 INCOMING A 1:1 meeting has been started with this user as the destination.
3 JOIN A meeting has been started remotely and the current user is a participant. This is not a 1:1 meeting.
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 One of the following removal reasons:
Sl. No Reason Description
1 SELF_REMOVED The server or a host removed the participant.
2 MEETING_INACTIVE_TERMINATING The meeting has ended or everyone has left.
3 CLIENT_LEAVE_REQUEST The participant triggered a leave meeting request.
4 CLIENT_LEAVE_REQUEST_TAB_CLOSED The participant triggered a leave meeting request by closing the browser tab.
5 NO_MEETINGS_TO_SYNC A meeting has been created locally but doesn't exist in the cloud server upon trying to sync meetings using syncMeetings().
6 MEETING_CONNECTION_FAILED The meeting failed to connect due to ICE candidate failures or firewall issues.

Network Disconnected Event

The 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
});
Clone this wiki locally