> For the complete documentation index, see [llms.txt](https://jmax45.gitbook.io/peerly/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jmax45.gitbook.io/peerly/api/events.md).

# Events

The client instance emits events that you can listen to, in particular you should use the 'connection' event to detect when the clients are connected and ready for communication.

<details>

<summary>connection</summary>

Fired when both peers are connected and ready for communication.

</details>

<details>

<summary>message</summary>

(message: Buffer) => void

\
Fired when a message was sent using the "send" method.

</details>
