I have a svelte component named [symbol].svelte in which I want to initiate a connection to a streaming service to receive server-sent events. I’ve not found a way to do this successfully. Since EventSource only runs in the browser, I initialized it in the onMount function like so: This works fine, except when I navigate to another route that uses
Tag: server-sent-events
Simple Way to Implement Server Sent Events in Node.js?
I’ve looked around and it seems as if all the ways to implement SSEs in Node.js are through more complex code, but it seems like there should be an easier way to send and receive SSEs. Are there any APIs or modules that make this simpler? Answer You should be able to do such a thing using Socket.io. First, you