5: The example app

The phlo-demo-poll repository is the realtime showcase: the Poll from the tutorial with Phlo Realtime built in. One repo holds both the plain async poll and the live version, so you can see exactly what Phlo Realtime adds.

5.1: From async poll to realtime

The Poll tutorial builds a poll that updates the page without a reload using a plain async form. Its final step hands off to Phlo Realtime: the same vote now also broadcasts, so every open tab updates at once, and an online badge shows how many people are watching.

The important property is that the poll still works without the realtime step. The broadcast is a single guarded cast(...) line; stop the realtime services and you are back to the single-tab async poll. That is the stepped-usability principle the whole example set follows.

5.2: What to read

5.3: Run it yourself

Clone the repository, point a host at www/, and start the Phlo Daemon and Phlo Realtime. The first request transpiles the sources; without the realtime services the app degrades to the plain async poll. The README documents both modes, so you can replicate each step from source.

We use essential cookies to make this site work. With your permission we also use analytics to improve the site.