Skip to main content
Version: 0.1.x

Meeting Connection Events - React

VideoSDK offers the onMeetingStateChanged() event, providing information about the current connection state of the meeting.

onMeetingStateChanged()

  • This event is triggered when the state of a meeting changes.
  • The event callback will include the current state of the meeting, which can be one of the following: CONNECTING, CONNECTED, FAILED, DISCONNECTED, CLOSING, CLOSED.
  • It can be subscribed to using the useMeeting hook.

Example

Here is an example demonstrating the usage of the event mentioned on this page.

function onMeetingStateChanged(data) {
const { state } = data;

swtich(state){
case 'CONNECTING':
console.log("Meeting is Connecting" );
break;
case 'CONNECTED':
console.log("Meeting is Connected" );
break;
case 'FAILED':
console.log("Meeting connection failed" );
break;
case 'DISCONNECTED':
console.log("Meeting connection disconnected abruptly" );
break;
case 'CLOSING':
console.log("Meeting is closing" );
break;
case 'CLOSED':
console.log("Meeting connection closed" );
break;
}
}

const {
meetingId
...
} = useMeeting({
onMeetingStateChanged,
...
});

API Reference

The API references for all the methods and events utilized in this guide are provided below.

Got a Question? Ask us on discord