Live poll

One poll, shared by everyone who visits. The count lives on the server; each vote is broadcast to all open windows.

Loading the poll

Connecting

    Open a second window

    How it works

    Clients never send votes to each other. A vote is a normal request to the backend, which updates its count and publishes the full result to the poll channel. Every browser replaces what it shows with what it receives, so nobody can drift out of sync.

    A window that opens later fetches the current result once over HTTP, then follows the channel. That pair, fetch then subscribe, is the pattern for any server-owned state: scores, stock levels, job progress.

    You can change your answer: the browser sends your previous choice along and the server moves the vote. This demo trusts the browser about that. A real poll would keep track of who voted on the server.

    backend (Rust, axum)
    async fn vote(State(app): State<App>, Json(vote): Json<Vote>) -> Json<Results> {
        let results = app.poll.add(&vote.option);
    
        // POST https://api.pikoman.se/poll/results
        app.pikoman.publish("poll", "results", &results).await;
    
        Json(results)
    }

    We are rebuilding the dashboard

    Self-service sign-up is closed while we do. Until the new dashboard is ready we set up apps by hand: write to us with a line about what you are building, and we will send you an app id and a secret.

    Write to hello@pikoman.se