# Connection

### `new Connection(options)`

Create a server to be able to connect remotely.

| Parameter                         | Default | Description                                                                                                                                                                                         |
| --------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| options                           |         | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a> (optional)<br>Connection options.</p>                                               |
| options.address                   |         | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><br>The address of the server to connect to.</p>                                     |
| options.authorization             |         | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><br>Your authorization settings to authenticate yourself on the server side.</p>     |
| options.authorization.username    |         | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><br>Username in the list of users specified in the server option.</p>                |
| options.authorization.password    |         | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><br>Password in the list of users specified in the server option.</p>                |
| options.auto\_reconnect           | `true`  | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a> (optional)<br>Whether to auto-reconnect when disconnected.</p>                    |
| options.auto\_reconnect\_interval | `5`     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a> (optional)<br>Interval of seconds it will try to reconnect after disconnection.</p> |

> Example:
>
> ```javascript
> const example_connection = new <PeakDB>.Connection({
>   "address": "127.0.0.1:4951",
>   "authorization": {
>     "username": "fir4tozden",
>     "password": "ZdJuTNqUXpqNrw2H"
>   },
>   "auto_reconnect": true,
>   "auto_reconnect_interval": 5
> });
> ```
