Using fetch with server-sent events

Поделиться
HTML-код
  • Опубликовано: 11 окт 2024

Комментарии • 12

  • @miazam123
    @miazam123 Год назад +3

    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!

  • @bhimeshk4866
    @bhimeshk4866 5 месяцев назад

    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!!

  • @anhtuantran4423
    @anhtuantran4423 7 месяцев назад +1

    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?

    • @covalence-io
      @covalence-io  7 месяцев назад

      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.

  • @GuilhermeXavier883
    @GuilhermeXavier883 4 месяца назад

    thank you my friend, you help a lot here

  • @RubiBox369
    @RubiBox369 5 месяцев назад +1

    Intro look like ww3

  • @julesbloux4279
    @julesbloux4279 2 месяца назад

    in french we say "tu me régales"

  • @pavithramkumar6276
    @pavithramkumar6276 Год назад

    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

    • @covalence-io
      @covalence-io  Год назад

      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

  • @daringcalf
    @daringcalf Год назад

    fetchEventSource starting 12:27

  • @mastertheblaster9997
    @mastertheblaster9997 Год назад

    How to terminate the connection

    • @covalence-io
      @covalence-io  Год назад +2

      You can use AbortController from the frontend which I talk about briefly at 14:14 or you can close the connection from the backend