Since You Opened This Page
Each bulb is a color this page received. When anyone changes the CheerLights color, a new bulb lights here, and lights around the world change with it.
What Arrives
This page keeps one WebSocket open to wss://wss.cheerlights.com. The first message is the current color, and a new one arrives each time the color changes. This is the last one it received:
Plain JSON, no library needed. New fields may be added later, so ignore the ones you do not use.
Put It on Your Page
Paste this into any web page. It turns the page the CheerLights color and follows every change.
<script>
function follow() {
const feed = new WebSocket("wss://wss.cheerlights.com");
feed.onmessage = (e) => (document.body.style.background = JSON.parse(e.data).hex);
feed.onclose = () => setTimeout(follow, 5000);
}
follow();
</script>
Even Shorter: Server-Sent Events
If your page only listens, EventSource does the same in one line and reconnects by itself.
<script>
new EventSource("https://wss.cheerlights.com").onmessage = (e) =>
(document.body.style.background = JSON.parse(e.data).hex);
</script>
Check the Color Once
To check the color once, ask for it: fetch("https://wss.cheerlights.com") answers with the same JSON.
Outside the Browser
- Node.js 22 and later have
WebSocketbuilt in: examples/node.mjs. - Python with no packages, reading Server-Sent Events: examples/follow.py.
- From a terminal:
curl -N -H "Accept: text/event-stream" https://wss.cheerlights.com - MQTT clients, devices, and Home Assistant keep using the CheerLights broker:
mqtt.cheerlights.comport 1883, orwss://wss.cheerlights.com/mqtt.
The full description of the feed is in docs/protocol.md.
Change the Color
Type /cheerlights on the CheerLights Discord and pick a color, or post on Bluesky with #cheerlights and a color. This page changes a moment later.