Martabak Queue — Realtime

Tell each martabak buyer's phone, no server of your own: WebSocket, Supabase, Durable Objects. 14 levels, played right in the browser with nothing to install.

What you learn in this game

With plain HTTP the phone always speaks first: it asks, the server answers, done. Polling means asking again and again with a fixed pause, so news that is already on the server waits for the next ask. In Antre Martabak all the code really runs. Tonight the laptop is a real Node http server and each phone is its own process. The night is played 100 times faster, but every ask is still a real request the laptop counts.

A realtime database is a database service that sends data changes to the clients subscribed to them, so there is no WebSocket server for you to keep. Supabase builds it on Postgres: every change is written to the WAL, Realtime reads it through a logical replication slot, checks who may receive it, then sends it over WebSocket. What is real here: the recorder's own Postgres 18.4 with a publication and a slot read with pgoutput, RLS rules decided by Postgres for each listener, and @supabase/supabase-js 2.117.3 on each phone. The Realtime server between them is this game's own wiring, following Supabase's protocol and documentation.

A Cloudflare Durable Object is one named object with its own storage, living in one place, running one request at a time. A Worker at the edge takes requests and passes them to the object through env.PAPAN.getByName(name). What is real here: the workerd runtime (through Miniflare from wrangler 4.149.0) on loopback, real WebSockets from each phone, the Hibernation API, and the real storage and input gates.