> ## Documentation Index
> Fetch the complete documentation index at: https://docs.threadify.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Unsubscribing

> Stop receiving notifications for specific events

**Unsubscribe** removes event handlers and stops receiving notifications for specific steps or events.

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Unsubscribe from specific step event
  threadify.unsubscribe('step.success', 'order_placed');

  // Unsubscribe from thread-level event
  threadify.unsubscribe('thread.completed');
  ```

  ```go Go theme={null}
  // Unsubscribe from specific step event
  err := conn.Unsubscribe(ctx, "step.success", "order_placed")
  if err != nil {
      log.Fatal(err)
  }

  // Unsubscribe from thread-level event
  err = conn.Unsubscribe(ctx, "thread.completed", "")
  if err != nil {
      log.Fatal(err)
  }
  ```

  ```python Python theme={null}
  # Unsubscribe from specific step event
  connection.unsubscribe("step.success", "order_placed")

  # Unsubscribe from thread-level event
  connection.unsubscribe("thread.completed")
  ```
</CodeGroup>

### When to Unsubscribe

| Scenario                  | Action                                          |
| ------------------------- | ----------------------------------------------- |
| **Cleanup on shutdown**   | Unsubscribe before closing connection           |
| **Dynamic subscriptions** | Remove handlers no longer needed                |
| **Memory management**     | Prevent handler leaks in long-running processes |

### Behavior

* Removes event handler from client
* Stops receiving notifications for that event/step combination
* Server stops sending notifications if no active subscriptions remain
* Safe to call multiple times (idempotent)
