Skip to main content
Removes a previously registered event listener.

Signature

client.off<T extends EventName>(event: T, callback: EventCallback<T>): this;

Parameters

ParameterTypeDescriptionRequired
eventEventNameThe name of the event to stop listening forYes
callbackEventCallback<T>The callback function to removeYes

Returns

this — the client instance, allowing method chaining.
You must pass the same function reference that was used with on(). Anonymous functions can’t be removed.

Example

const onAnswered = (session) => {
  console.log('Call answered:', session.id);
};

// Subscribe
client.on('answered', onAnswered);

// Unsubscribe
client.off('answered', onAnswered);

More Information