EnableX API provides different methods to access Room Information.

Table of Contents

Get Room ID

Every Room is assigned with a Unique Room ID while creating the Room. The Room ID of the room to which you are connected may be known by using window.EnxRtc.getRoomId() method.

Method: getRoomId( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.getRoomId(function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Get Room Meta Information

To know Meta Information of the Room to which you are connected, you may use window.EnxRtc.getRoomMetaData() method. Room Meta information contains complete room definition along with many run-time parameters with their current values & room stats of connected users and streams. This is received by all endpoints after getting connected to Room along with onRoomConnected event listener. Some of the run-time parameters are updated internally by the Toolkit on various events.

Method: getRoomMetaData( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.getRoomMetadata(function (data) {
console.log('Excelsior succuss! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Know if the Room is Connected

To know the status of the Room if it is connected or not, you may use window.EnxRtc.isConnected() method.

Method: isConnected( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.isConnected(function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Get Room Mode

A connected Room may be in group or lecture mode. Use window.EnxRtc.getMode() to know the room mode.

Method: getMode( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.getMode(function (data) {
console.log('Excelsior succuss! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Get Connected User ID or Client ID

Each connected user to the Room is assigned a Unique Client ID for the session. To know the Client ID of the connected user from the endpoint, use window.EnxRtc.getClientId() method.

Method: getClientId( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.getClientId (function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Get Connected User Name

To know the name of the connected user from the endpoint, use window.EnxRtc.getClientName() method.

Method: getClientName( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.getClientName(function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));});

Get Connected User Role

A User connected to a Room with either role of moderator or participant. Use window.EnxRtc.getRole() to know the role of the user

Method: getRole( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback

Returns: Enumerated Values: moderator, participant

window.EnxRtc.getRole(function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Get Connected User Information at an End-Point

To get connected user information at an End-Point, use window.EnxRtc.whoami() method. It returns complete user-meta for the connected user in a JSON Object.

Method: whoami( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.whoAmI(function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Note: Refer JSON Object structure for User Meta

Get Connected User List

To get a list of connected users to the Room to which the endpoint is also connected to, use window.EnxRtc.getUserList() method. It returns a JSON with a list of connected user’s information.

Method: getUserList( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.getUserList(function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

Get Local Stream ID

All Streams are identified by its Stream ID, be it a local or a remote stream, a canvas stream or a screen share stream.

You may get the ID of the Local Stream using window.EnxRtc.getLocalStreamID()method.

Method: getLocalStreamID( successCallback, errorCallback )

Parameters:

  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
window.EnxRtc.getLocalStreamID(function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});