Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3297 มุมมอง

Hello! 


i am trying to do a SSE aplication, where everytime a new register in an odoo module pushes its info to a frontend located outisde odoo.


The idea is something like this


var eventSource = new EventSource("http://localhost:8069/stream");
eventSource.addEventListener = (function(e) {
    console.log(e.data)
});


@http.route("/stream", auth='public', cors='*', csrf=False, type='http', website='true') 

def stream(self): 


    return Response(eventStream(), mimetype="text/event-stream")


def eventStream(): 

    yield "data: test\n\n"


bu ti think im going for the wrong path to solve this, since this is just calling the server forever

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Just stumbled upon you post. I have done a similar thing recently and don't see anything wrong with your code.
Could you be more clear on what what happening if this still matters to you?


From the information available, it might just be a misunderstanding on what SSE are or an issue on the frontend.


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Erick! Did you ever figure out the answer to your question?
I'm looking into adding SSE for AI streaming.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ม.ค. 19
4294
0
ก.ย. 21
2638
1
พ.ค. 25
906
0
ต.ค. 24
1135
0
มิ.ย. 24
1185