Is there some way I can poll to an endpoint using astro??
I'm currently using SSR to get the data from the endpoint at page request time. But I would like to poll to that endpoint and update the astro component every few seconds. How would I achieve this??
Solution SSE
you can achieve that with SSE Server Sent Event. in this example I update Astro client side from events coming from mqtt client running on the server, so that client can see updates coming without refreshing the page nor keep polling an api.
Example
api
client script
Reference example
as it is more practicale to see the above code in real example, here reference in a full project with the above code