## Broadcast Message:

import { Story } from '@storybook/addon-docs';

This will be received by everyone in the room.

```js
hmsActions.sendBroadcastMessage('hello everyone!'); // yes it's that simple 😉
```

## MVP component

```jsx
const ChatExample = () => {
  const chats = useHMSStore(selectHMSMessages);
  const actions = useHMSActions();
  const [input, setInput] = useState('');
  const sendMessage = (e: React.FormEvent) => {
    e.preventDefault();
    actions.sendBroadcastMessage(input);
    setInput('');
  };
  return (
    <div>
      {chats.map(c => (
        <div>{c.message}</div>
      ))}
      <form onSubmit={sendMessage}>
        <input value={input} onChange={e => setInput(e.target.value)} type="text" />
        <button type="submit">Send</button>
      </form>
    </div>
  );
};
```

### Demo

<Story id="chat-broadcast-message--chat-story-example" />
