Post #2901534
2026-05-14 18:05 UTC
@alex@social.alexwlchan.net Nice! Long polling for messaging like this has been formalised as Server-side Events for what it's worth - https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
It lets you send various messages (like "reload me please") from the server with a nice event-based client-side API. This is how esbuild's Live Reload functionality works (https://esbuild.github.io/api/#live-reload):
```javascript
new EventSource('/esbuild').addEventListener('change', () => location.reload())
```
Replies (1)
-
@alex@social.alexwlchan.net 2026-05-17 12:53
@dionrhys@toot.wales Neat, thank you! I added a link to the post. I like the simplicity of mine given I only have a single event, but now I’m wondering what other sorts of app I could build with an EventSource 🤔