> ## Documentation Index
> Fetch the complete documentation index at: https://developer.watson-orchestrate.ibm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# off()

Removes a subscription to an event type. The specified handler will no longer be called when the event occurs.

## Syntax

```javascript theme={null}
instance.off(eventName, handler);
```

## Parameters

**eventName** *required*

The name of the event to unsubscribe from.

**handler** `function` *required*

The specific callback function to remove. Must be the same function reference that was used with `on()` or `once()`.

## Returns

**void**

Returns a `void` operator.

## Examples

The following examples show different ways to unsubscribe from events:

```javascript theme={null}
// Define a handler
function receiveHandler(event, instance) {
    console.log('Message received:', event);
}

// Subscribe to event
instance.on('receive', receiveHandler);

// Later, unsubscribe from event
instance.off('receive', receiveHandler);

// Unsubscribe after first use
instance.on('receive', (event, instance) => {
    console.log('Received:', event);
    instance.off('receive', receiveHandler);
});
```

> [card] [Do you need practical examples?](https://www.ibm.com/docs/SSAVQO/deploy/web_chat_agent/tutorials/tutorials_lp.html)
>
> Learn how to apply the features available for embedded chat into your implementation with guidance and examples.
