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

# close()

> **close**(`code?`, `reason?`): `void`

Detach all sockets (call on actor deactivation if you want a clean close).

**Parameters**

| Parameter | Type | Default value |
| - | - | - |
| `code` | `number` | `1001` |
| `reason` | `string` | `"agent going away"` |

**Returns**

`void`

## Close Codes

The default code `1001` is the code a client also receives when an actor restarts or moves. On it, a client reconnects promptly, as [Connection Lifecycle](/docs/edge-compute/stateful-actors/websockets/lifecycle#how-connections-end) describes.
