> For the complete documentation index, see [llms.txt](https://earnbit.gitbook.io/earnbit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://earnbit.gitbook.io/earnbit/developers/exchange-api-documentation/basic-structure-or-websoket.md).

# Basic structure | WEBSOKET

### Endpoint

```javascript
ws.earnbit.com
```

{% hint style="info" %}
The connection will be closed by the server in case of inactivity from the client after 60 seconds.
{% endhint %}

### Request parameters

| Name                                     |   Type  |                            Desciption                            | Example     |
| ---------------------------------------- | :-----: | :--------------------------------------------------------------: | ----------- |
| method<mark style="color:red;">\*</mark> |  STRING |                            Method name                           | server.ping |
| params                                   |  ARRAY  |         Array of parameters required by a specific method        | -           |
| id<mark style="color:red;">\*</mark>     | NUMERIC | Request ID, Should be unique to handle response for your request | 1           |

### Response Example

|  Name  |     Type    | Success |  Error  |
| :----: | :---------: | :-----: | :-----: |
|   id   |   Integer   | NUMERIC | NUMERIC |
| params |    ARRAY    |  ARRAY  | Failure |
| result | JSON Object |  ARRAY  |   NULL  |
|  error | JSON Object |   NULL  | Failure |

### General error code:

* internal error
* service unavailable
* method not found
* service timeout
* require authentication
