> For the complete documentation index, see [llms.txt](/llms.txt).

- Snap

# snap_closeWebSocket

Closes a WebSocket connection that was previously opened with [snap_openWebSocket](https://metamask-docs-f8nytczy3-consensys-ddffed67.vercel.app/snaps/reference/snaps-api/snap%5Fopenwebsocket).

## Parameters[​](#parameters "Direct link to Parameters")

object

required

An object containing the parameters for the `snap_closeWebSocket` method.

### id

string

required

The ID of the WebSocket connection to close.

## Returns[​](#returns "Direct link to Returns")

null

This method does not return any data, so the result is always `null`.

## Example

- Manifest
- Usage

```
{
  "initialPermissions": {
    "endowment:network-access": {}
  }
}

```

```
await snap.request({
  method: 'snap_closeWebSocket',
  params: { id: 'websocket-1' },
})

```
