# Javascript: WebSocketClosedEventArgs.reason Property

> The reason the server closed the connection. This is specific to the particular server and sub-protocol.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 24.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: WebSocketClosedEventArgs.reason Property
- **180 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/websocketclosedeventargs/reason-property/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/websocketclosedeventargs/reason-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/websocketclosedeventargs/reason-property/llms-full.txt

---

### Description

The reason the server closed the connection. This is specific to the particular server and sub-protocol.

### Syntax

```javascript
<string> WebSocketClosedEventArgs.reason
```

### Examples

The following example demonstrates `WebSocketClosedEventArgs.reason` in a practical document-editing workflow. The reason the server closed the connection. This is specific to the particular server and sub-protocol.

```javascript
function inspectReason(webSocketClosedEventArgs) {
    const reason = webSocketClosedEventArgs.reason;
    console.log("reason:", reason);
}
```

---

## Nearby

- **Previous:** [Javascript: WebSocketClosedEventArgs.code Property](https://docs.textcontrol.com/ds-server/reference/javascript/websocketclosedeventargs/code-property/llms-full.txt)
- **Next:** [Javascript: WebSocketClosedEventArgs.wasClean Property](https://docs.textcontrol.com/ds-server/reference/javascript/websocketclosedeventargs/wasclean-property/llms-full.txt)
