> ## 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

<ParamField path="eventName" string="type" required>
  The name of the event to unsubscribe from.
</ParamField>

<ParamField path="handler" type="function" required>
  The specific callback function to remove. Must be the same function reference that was used with `on()` or `once()`.
</ParamField>

## Returns

<ResponseField name="void">
  Returns a `void` operator.
</ResponseField>

## 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 title="Do you need practical examples?" icon="text-align-start" href="https://www.ibm.com/docs/SSAVQO/deploy/web_chat_agent/tutorials/tutorials_lp.html" arrow="true" cta="Learn with walk-throughs" horizontal>
  Learn how to apply the features available for embedded chat into your implementation with guidance and examples.
</Card>
