Skip to main content

WebRTC JS Notification

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.

TYPEDESCRIPTIONADDITIONAL PROPERTIES
callUpdateA call has changed statecall
userMediaErrorThe browser does not have permission to access media devicesbrowser

Examples

Usage with TelnyxRTC Client .on:

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

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

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

userMediaError

{
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

On this page