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

# Events

```javascript
import { Im } from "@relationlabs/im";

myIm.bind(Im.RECEIVE_MSG_OK, (e) => {
    const message = e['im-message']
})
```

|       **Name**      |                                **Description**                               |                     **Callback Params**                    |
| :-----------------: | :--------------------------------------------------------------------------: | :--------------------------------------------------------: |
|    Im.CONNECT\_OK   |                 Triggered by a successful socket connection.                 |                                                            |
|   Im.CONNECT\_ERR   |                    Triggered by a socket connection error.                   |                                                            |
|  Im.CONNECT\_CLOSE  |                   Triggered by closing a socket connection.                  |                       { reason: '' }                       |
| Im.RECEIVE\_MSG\_OK | Triggered by receiving a new message after establishing a socket connection. | { 'im-message': { channelUuid, sendUuid, from, content } } |
|                     |                                                                              |                                                            |
|         ---         |                                                                              |                                                            |
