*** id: 0c1e01c3-c188-41ad-beef-5c01507500c1 title: 'on' slug: /node/reference/video/room-session/on description: on method for the RoomSession class. max-toc-depth: 3 ---------------- ### on * **on**(`event`, `fn`) Attaches an event handler to the specified event. #### Parameters | Name | Type | Description | | :------ | :------- | :------------------------------------------------------------------------------------------------------------------------------ | | `event` | `string` | Name of the event. See [Events](/docs/server-sdk/v3/node/reference/video/room-session/events) for the list of available events. | | `fn` | Function | An event handler. | #### Example In the below example, we are listening for the `call.state` event and logging the current call state to the console. This means this will be triggered every time the call state changes. ```js call.on("call.state", (call) => { console.log("call state changed:", call.state); }); ```