5: The example app

The phlo-demo-websocket repository is the realtime showcase, and it picks up exactly where the Poll tutorial ends. It is the Poll app plus realtime, so you can diff the two to see precisely what phloWS 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 phloWS: 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; remove the broker 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 phloWS broker. The first request compiles the sources; without the broker the app degrades to the plain async poll. The README documents both modes, so you can replicate each step from source.

We gebruiken essentiële cookies om deze site te laten werken. Met uw toestemming gebruiken we ook analytics om de site te verbeteren.