Overview - JS Notification

An event dispatched by Telnyx to notify the client of changes to the session or call.

The conditions of the event can be identified by the type property.

TYPE DESCRIPTION ADDITIONAL PROPERTIES
callUpdate A call has changed state call
userMediaError The browser does not have permission to access media devices browser

Examples

Usage with TelnyxRTC Client .on:

Copy
Copied
client.on('telnyx.notification', (notification) => {
  if (notification.type === 'callUpdate') {
    console.log(notification.call);

    // Do something with the call and update UI accordingly
  } else if (notification.type === 'userMediaError') {
    console.log(notification.error);

    // Handle the error and update UI accordingly
  }
});

Note: After pasting the above content, Kindly check and remove any new line added

Data structure

The notification structure is determined by its type.

callUpdate

Copy
Copied
{
  type: 'callUpdate',
  call: Call // current call
}

Note: After pasting the above content, Kindly check and remove any new line added

userMediaError

Copy
Copied
{
  type: 'userMediaError',
  error: Error
}

Note: After pasting the above content, Kindly check and remove any new line added

.call

The current call. Reference this call state to update your UI. See Call documentation.

Type: ICall

.error

Error from the userMediaError event. Check your audio and video constraints for browser support.

Type: Error

.type

Identifies the event case.

Type: string