@@ -41,7 +41,7 @@ modes, each scoped to the view that needs it.
4141cannot publish poll messages, and cannot subscribe to other voters' raw
4242annotations, so it can't tamper with the poll or snoop on individual votes. See
4343the per-role capabilities in
44- [ ` server/src/server.ts ` ] ( https://github.com/ably/docs/tree/main/examples/pub-sub- live-voting/javascript /server/src/server.ts ) .
44+ [ ` server/src/server.ts ` ] ( https://github.com/ably-demos/ live-voting-with-annotations/blob/main /server/src/server.ts ) .
4545
4646** One vote per person, enforced by Ably.** Votes use the ` unique ` aggregation
4747(` vote:unique.v1 ` ). In this aggregation mode, Ably keeps at most one vote per
@@ -137,49 +137,21 @@ namespace before running this against your own app.
137137
138138## Getting started
139139
140- The live demo above runs entirely in the browser. The full app — the
141- voter/presenter/admin client plus the backend (` server/ ` ), the poll data
142- (` data/ ` ) and the database schema (` database/ ` ) — all lives under this
143- ` javascript/ ` folder, so "Open in CodeSandbox" gives you the whole project. To
144- run it locally:
145-
146- 1. Clone the [Ably docs](https://github.com/ably/docs) repository:
147-
148- ` ` ` sh
149- git clone git@github .com : ably/ docs .git
150- cd docs/ examples/ pub- sub- live- voting/ javascript
151- ` ` `
152-
153- 2. Run the client. From the docs repo's ` examples/ ` directory:
154-
155- ` ` ` sh
156- yarn install
157- yarn pub- sub- live- voting- javascript # Vite dev server on http: // localhost:5173
158- ` ` `
159-
160- Vite proxies ` / auth` and ` / api` to the server on port 3000.
161-
162- 3. Run the server (in a separate terminal). It's a standalone sub-project:
163-
164- ` ` ` sh
165- cd examples/ pub- sub- live- voting/ javascript/ server
166- cp .env .example .env # set ABLY_API_KEY (keyName: keySecret) and ADMIN_PASSWORD
167- npm install
168- npm run dev # auth + polls API on http: // localhost:3000
169- ` ` `
170-
171- By default the server reads polls from the static ` data/ demo- shows .json ` file
172- (` SHOWS_FILE ` ); to use Postgres instead, unset ` SHOWS_FILE ` and create the
173- schema with the SQL in ` database/ ` .
174-
175- 4. Open the client. The default view is the voter; add ` ? role= admin` to drive
176- the show and ` ? role= presenter` for the big screen. The admin generates a
177- session and a QR code that points voters at the right ` ? s= ` session.
178-
179- In this clone the client never sees an API key — it calls the server's ` / auth`
180- endpoint for short-lived, role-scoped tokens. The hosted demo above has no
181- backend, so it uses a raw key embedded in the page; this is just for demo
182- purposes and should never be done in the real app.
140+ The live demo above runs entirely in the browser. For a complete app you can
141+ clone and run yourself — admin, voter and presenter, with proper token
142+ authentication and none of the in-page scaffolding — get
143+ [ably-demos/live-voting-with-annotations](https://github.com/ably-demos/live-voting-with-annotations).
144+
145+ Its README has the full setup, but in short: give the server an Ably API key and
146+ an admin password, pick the static (` SHOWS_FILE ` ) or Postgres poll store, then
147+ run the server and the client. The default view is the voter; ` ? role= admin`
148+ drives the show and ` ? role= presenter` is the big screen, and the admin shows a QR
149+ code that points voters at the right session.
150+
151+ The client never sees an API key — it calls the server's ` / auth` endpoint for
152+ short-lived, role-scoped tokens. The hosted demo above has no backend, so it uses
153+ a raw key embedded in the page; that's just for the demo and should never be done
154+ in a real app.
183155
184156## Related
185157
0 commit comments