Post #2901531
2026-05-14 07:57 UTC
Replies (3)
-
@alterelefant@mastodontech.de 2026-05-14 08:01
@alex@social.alexwlchan.net One could use a socket for that, however I have no hands on experience with this particular use case.
-
@dokas@mas.to 2026-05-14 15:44
@alex@social.alexwlchan.net This is great, I love your posts like this!
-
@dionrhys@toot.wales 2026-05-14 18:05
@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()) ```