Closed andersr closed 6 months ago
Hi @andersr
This is something that I actually came upon myself recently. I have not yet added an example to the repo, but let me have a play around and see how it would work with remix-sse
Ok @andersr
So to answer your question, firstly because Server Sent Events are unidirectional - we cannot send data to the streaming route to say "hey start sending events"
So with that in mind, the solution is as follows
If you need more communication than this, then I would recommend a Websocket instead
Heres a quick PR I made that adds an example to the repo
https://github.com/dan-cooke/remix-sse/pull/25/files
Let me know if you have any other questions!
Have a nice day :)
@dan-cooke thanks so much for looking into this and for posting an example. Yes, using a session store as the "connector" between a non-resource route and the SSE route makes a lot of sense. Going to give that a shot. Thanks again!
Closing this in the meantime!
Hi, this packages looks very interesting but it's not clear how I would trigger an event from outside the resource route. All the current examples are "self-triggering" ie just using an interval timer. How would I, for example, trigger a new event if something is created in a form in the action of a different route? Thanks for any insights!