> For the complete documentation index, see [llms.txt](https://bmsvieira.gitbook.io/nova-irc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bmsvieira.gitbook.io/nova-irc/methods/connect.md).

# connect

Since you already defined your credentials with [setCredentials](/nova-irc/methods/setcredentials.md) method, is now time to establish a connection to an IRC server with the specified settings.

#### Syntax

```javascript
bot.connect({
    server, 
    port, 
    ssl, 
    messageColor, 
    removeColors, 
    rejectUnauthorized,
    rejoinLimit,
    rejoinDelay,
    maxLineLength
});
```

#### Parameters

* **`server`** *(string, required)* – The IRC server address to connect to.
* **`port`** *(number, required)* – The port number to use for the connection.
* **`ssl`** *(boolean, required)* – Determines whether to use SSL encryption.
* **`messageColor`** *(string, optional)* – Sets the color for messages, based on the [IRC Color Table](/nova-irc/get-started/available-colors.md).
* **`removeColors`** *(boolean, optional, default: `true`)* – Removes IRC color codes from messages.
* **`rejectUnauthorized`** *(boolean, optional, default: `false`)* – Whether to reject unauthorized SSL certificates.
* **`rejoinLimit`** *(number, optional)* – Number of times it will try to rejoin a certain channel.
* **`rejoinDelay`** *(number, optional)* – Delay (in ms) of wich it will try to rejoin a certain channel.
* **`maxLineLength`** *(number, optional)* – Max. characters that is allowed per message, after that it will be splitted into the next message.

#### Example Usage

```javascript
bot.connect({
    server: 'irc.libera.chat',
    port: 6697,
    ssl: true,
    messageColor: "green",
    removeColors: true,
    rejectUnauthorized: false,
    rejoinLimit: 3,
    rejoinDelay: 5000, // ms
    maxLineLength: 350
});
```

#### Notes

* Ensure the server and port values match the intended IRC network.
* If using SSL, make sure the server supports secure connections.
* `messageColor` should correspond to a valid IRC color code.
* Set `rejectUnauthorized` to `true` only if strict SSL verification is needed.
* Once the connection is successfully established, the bot will emit a **`connected`** event.
