Closed GoChartingAdmin closed 7 years ago
Can you try to create first eventsource with lastEventID = 0 (to get the initial dump) and on receipt of the message close it. And then again establish a second eventsource without the lastEventID to get the usual periodic refresh?
I'm kind of swamped right now, so I don't have time to dive into this fully, but if you're using IDs, they should be numeric. Either use a counter for the IDs, or use Date.now()
instead of (new Date()).toISOString()
This doesn't seem like a bug, but an implementation problem. If you have a more specific bug to report, please comment. Closing.
Hi,
I am new to the concept of SSE and hence please excuse my naiveness. I have used your package and it works like a charm. Here is the issue I am facing and would like some guidance.
I am creating a stock market watchlist in my app where the server is repeatedly downloading the ticker price data from the database and sending it to all the client using your package. The front end uses ReactJS which is somewhat irrelevant in this context
client.js
And server-side uses your example using express with small tweak to the data-provider.js
channels.js
As you can see, the idea is to first trigger priceFeeder 5000ms after the server starts and then periodically after every 1 minute. This works per expectation but the issue is with the client side.
When the client starts and establishes the SSE connection using the url 'http://localhost:3000/channel/liveFeed?', it starts getting the feed from the server only after the first data refresh on the server side post client launch. So, for ~ 1minute, it shows no data and then starts refreshing as usual.
Now if I change the url to 'http://localhost:3000/channel/liveFeed?lastEventId=0', the client gets all the data from the start the moment the client launches (which is great) but it does not refresh every time new data is sent by the server (auto refresh does not work anymore).
The client should see some data the moment it launches and then get refreshed every 1 minute when new data is sent by the server through SSE. This is the base case and I do have some small complexities which I can resolve once this base setup is up and running.
Please help me if this is something can be achieved using your package/
Regards SD