#I tried to implement sse but it doesn't work. What is the reason?
1 messages · Page 1 of 1 (latest)
what's most likely happening is that you need to keep the instance of emitter on globalThis to ensure it's not re-created between reloads
you need something like this https://www.npmjs.com/package/@epic-web/remember
I didn't understand it properly. How can I use the above npm after installing it?
export let emitter = remember("emitter", () => new EventEmitter())
the first argument of remember is a string, it can be anything as far as you're not repeating it with another remember call
need other way, After installing that package, I need to change config.js, but I can't do that now.
this is the source code, copy it to your app https://github.com/epicweb-dev/remember/blob/main/index.js
This? And what can do with this npm?
I really don't understand, if you don't mind, can you show me an example based on the code in my post?
copy that in a file inside your app, uninstall the package from npm, use the code you copied the same way I showed before, just import from the local file instead of the package
https://sergiodxa.com/articles/use-server-sent-events-with-remix
I followed the link above, but I don't understand it.
Using Server-Sent Events (SSE) you can keep a connection between a browser (client) and an HTTP server open an...