# Overview

We use Socket.IO v4 protocol for WebSocket communication.

### Connection Information

* **WebSocket URL**:
  * for sandbox: `https://wss-test.1dex.com/socket.io`
  * for production: `https://wss.1dex.com/socket.io`
* **Protocol**: Socket.IO v4
* **Ping Interval**: 10 seconds
* **Ping Timeout**: 5 seconds
* **Connection Timeout**: 5 seconds

### Authentication Flow

#### 1. User Authentication

Users can authenticate by sending the `authenticate` event:

```javascript
socket.emit('authenticate', 'api-key');

socket.on('authenticated', (response) => {
    console.log(response);
    // response:
    // {
    //     "status": "success",
    //     "account": "account"
    // }
});
```

#### 2. Unauthenticate

```javascript
socket.emit('unauthenticate', 'api-key');
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.1dex.com/developer/websocket-streams/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
