Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3312 Visualizzazioni

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

Avatar
Abbandona
Risposta migliore

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.


Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
gen 19
4327
0
set 21
2644
1
mag 25
914
0
ott 24
1145
0
giu 24
1192