PShowcase
EN NL
17 / 20

Realtime (Phlo Realtime)

Phlo Realtime pushes the same update to every open tab.

.phlo
// vote, then push the new results to every open tab.
route both POST poll vote $id {
	poll::change('id=?', $id, votes: $o->votes + 1)
	cast(wsTarget: 'all', outer: ['#results' => $this->results])
	if (%req->async) return apply(outer: ['#results' => $this->results])
}

// app.ws.phlo: the daemon calls these hooks on connect and close
function wsConnect($host, $token, $socket){ presence::create(socket: $socket) }
0 onlineOpen this page in a second tab, then vote: both update at once.
React 50%
Svelte 50%
Vue 0%
phlo.js 0%