# RCWeb Audience Q&A Control

`qanda-c` is the phone controller for the `qanda` Audience Q&A display. It lets participants submit questions, edit the poster name stored as `localStorage.rcwebName`, and upvote questions submitted by other people.

![icon](pwa-512x512.png "Slideshow Display Icon")

Open it by scanning the QR code shown on `/qanda/`, or by visiting `/qanda-c/?r=<room>` with the same room ID as the display.

## What The Control Shows

The control screen is optimized for portrait phone use. It shows:

- A name field populated from `rcwebName`.
- A question submission form.
- A live list of submitted questions.
- Upvote buttons for questions from other participants.
- Disabled states for your own questions and selected states for questions you have already upvoted.
- Connection and submission status messages.

## How To Ask

Enter or edit your name, type a question, and tap **Submit question**. The control trims repeated whitespace and caps names at 32 characters and questions at 220 characters so they remain readable on the shared display.

If no name has been saved on the device, the control uses `Guest`. Saving a name writes it back to the shared RCWeb local storage key `rcwebName`, so other RCWeb apps can reuse it. The control also sends the new name to the display, which updates every existing question from that participant and broadcasts the change to all controls.

## How Upvotes Work

Each browser gets a saved participant ID in local storage. That ID is separate from the display name, so renaming yourself does not reset your upvote history.

You can upvote each question from another participant once, then tap **Remove upvote** to toggle it off. You cannot upvote your own question, and repeated add/remove taps are validated by the display so duplicate votes are not counted.

## Important Behavior

The `qanda` display owns the live question state. `qanda-c` sends requests, but it does not decide final rankings locally.

If the display is not open in the room, the control can still render but submissions and upvotes will wait without changing a shared screen. When the display is available, controls request and receive the authoritative snapshot.

If the display refreshes, the live Q&A state resets because the display stores the session state in memory.

## Powered By RCWeb

Audience Q&A Control communicates with the display through RCWeb function calls over the room WebSocket connection. It sends submit and upvote requests to `qanda`, receives snapshots from the display, and redraws the phone UI from those snapshots.
