# roomStateUpdated

Emitted when the room state changes. The updated room state is included in the payload.

Read about the room state specification in the [roomState](https://docs.digitalsamba.com/reference/sdk/properties/roomstate) property.

{% hint style="info" %}
You can also access the latest room state through the [roomState](https://docs.digitalsamba.com/reference/sdk/properties/roomstate) property.
{% endhint %}

#### Sample payload

```json
{
  "type": "roomStateUpdated",
  "data": {
    //Look at the roomState property for full payload description
  }
}
```

#### Sample subscription code

```javascript
sambaFrame.on('roomStateUpdated', (event) => {
  const data = event.data;
  //Read some properties from the updated room state
  //data.layout.mode
});
```
