A combination of workers, websockets and "durable objects" (which I've not heard of before).

A detailed walk through of the tech is on CloudFlare - and I do hope the domain remains active for years to come, I'm certainly challenging the 90s teenager in me when I hear those sound effects.

Death match anyone!?

Source: silentspacemarine.com