Flask + SSE + React | How to use Server Sent Events with Flask and React

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ต.ค. 2024

ความคิดเห็น • 10

  • @devkunjadia3792
    @devkunjadia3792 3 หลายเดือนก่อน +1

    Thank you!!!!!!!!!!!

  • @janistakumwan328
    @janistakumwan328 4 หลายเดือนก่อน +1

    thanks for give me guide!

  • @sakshipande5197
    @sakshipande5197 ปีที่แล้ว +1

    THANKS A LOT!! This helped me tonss!

  • @jordialmendros197
    @jordialmendros197 ปีที่แล้ว +1

    Great guide, thanks a lot, it's very usefull !
    Looks like I'm not able to use SSE while using Next.js ... I think has something to do with a proxy rewrite + compression, such a shame

    • @michaelfore6814
      @michaelfore6814  10 หลายเดือนก่อน

      I played around with a PR to get that to work. It is possible, just not straightforward or kind

  • @itsmee3372
    @itsmee3372 2 ปีที่แล้ว +1

    nice information thanks

  • @blankcode4265
    @blankcode4265 2 ปีที่แล้ว +2

    Do you think using SSE is better approach than ... flask-socket-io ? Or am I misunderstanding how differently both approaches can be used? For example let's say I have a backend which also is communicating with Hardware (Camera, PLC or something) and then I'm doing some kind of processing with the given data from the hardware and then I want to update UI from the server side. Should I be using multiple while loops with Threads + Queue mechanisms (so while loops wouldn't eat CPU time) or I should use Sockets for such thing ? Sorry for the long question and thank you for the video !

    • @michaelfore6814
      @michaelfore6814  2 ปีที่แล้ว +3

      I don't deal with hardware much, but from my understanding use sockets when you need Two-Way communication. If the communication is unidirectional SSE is a good solution to choose.
      In your example, is the server sending information back to the devices?

  • @juliushuck
    @juliushuck ปีที่แล้ว

    Hi, do you know how to make this work cross origin? We are struggling with that 😅

    • @michaelfore6814
      @michaelfore6814  10 หลายเดือนก่อน

      have the server respond with allowing all cors headers