> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # on > on method for the RoomSession class. ### on * **on**(`event`, `fn`) Attaches an event handler to the specified event. #### Parameters | Name | Type | Description | | :------ | :------- | :-------------------------------------------------------------------------------------------------------- | | `event` | `string` | Name of the event. See the list of [events](/docs/browser-sdk/v3/js/reference/video/room-session/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); }); ``` > on method for the RoomSession class.