Your video solved my issue. The connection was getting closed shortly after subscribing for events as I was not using X-Accel-Buffering header. Thanks!
I'm so thankful for making this video, it's really helpful. I'm facing with a challenge after initial response, event source is getting closed. Hope I will hear back from you!!
thanks! that helped a lot! is there a way to keep fetching and streaming data when switching tabs? openWhenHidden: true keeps the connection alive but when streaming data it pauses when switching tabs or minimize the browser. can i keep streaming even when the browser is minimized or the tab is switched?
This may be a memory/processing limitation implemented by the browser. Have you looked into whether this is the case in every browser? Regardless, it may be a solution you have to handle by immediately grabbing the data you've missed once the session becomes active again.
Hello, I watched this video and its amazing. I am stuck with a problem however, i am using this in a react application to get status updates from the server to the frontend. i am getting the status updates properly. however, the very first message i receive cannot be updated using setstateVariable(var) [ .... this is an example of useState() variable i have used in the functinal component]. But I can update the next following messages. Idont understand why that is so. if you have ever experienced this weird issue and know the solution it would be of great help. thank you
Hmm seems like a problem that's pretty specific to how you have your code in particular. I'd recommend logging everywhere you're setting that variable and making sure the values are what you expect them to be and also make sure there's no race conditions where something else is setting the value after your first message is received
Your video solved my issue. The connection was getting closed shortly after subscribing for events as I was not using X-Accel-Buffering header. Thanks!
I'm so thankful for making this video, it's really helpful. I'm facing with a challenge after initial response, event source is getting closed. Hope I will hear back from you!!
thanks! that helped a lot! is there a way to keep fetching and streaming data when switching tabs? openWhenHidden: true keeps the connection alive but when streaming data it pauses when switching tabs or minimize the browser. can i keep streaming even when the browser is minimized or the tab is switched?
This may be a memory/processing limitation implemented by the browser. Have you looked into whether this is the case in every browser? Regardless, it may be a solution you have to handle by immediately grabbing the data you've missed once the session becomes active again.
thank you my friend, you help a lot here
Intro look like ww3
in french we say "tu me régales"
Hello,
I watched this video and its amazing. I am stuck with a problem however, i am using this in a react application to get status updates from the server to the frontend. i am getting the status updates properly. however, the very first message i receive cannot be updated using setstateVariable(var) [ .... this is an example of useState() variable i have used in the functinal component]. But I can update the next following messages. Idont understand why that is so. if you have ever experienced this weird issue and know the solution it would be of great help. thank you
Hmm seems like a problem that's pretty specific to how you have your code in particular. I'd recommend logging everywhere you're setting that variable and making sure the values are what you expect them to be and also make sure there's no race conditions where something else is setting the value after your first message is received
fetchEventSource starting 12:27
How to terminate the connection
You can use AbortController from the frontend which I talk about briefly at 14:14 or you can close the connection from the backend