## ReconnectingWebSocket.close() method [​](/content/docs/sdk/core.reconnectingwebsocket.close#reconnectingwebsocketclose-method "Direct link to ReconnectingWebSocket.close(/index.html) method")

Closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.

**Signature:**

```typescript
close(code?: number, reason?: string): void;
```

## Parameters [​](/content/docs/sdk/core.reconnectingwebsocket.close#parameters "Direct link to Parameters"/index.html)

| Parameter | Type | Description |
| --- | --- | --- |
| code | number | _(Optional)_ The code to close with. Default is 1000. |
| reason | string | _(Optional)_ An optional reason for closing the connection. |

**Returns:**

void

- [ReconnectingWebSocket.close() method](/content/docs/sdk/core.reconnectingwebsocket.close#reconnectingwebsocketclose-method/index.html)
- [Parameters](/content/docs/sdk/core.reconnectingwebsocket.close#parameters/index.html)
