Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
Continue to receive server sent event after leaving and returning to a page

I have an EventSource that does nothing initially:

var source = new EventSource('{{do_nothing}}');

Then I trigger something in my flask backend and it changes my 'do_nothing' to a server sent event:

var source = new EventSource('/my_event');

and this server sent event will start sending (yielding) data where my source will pick it up and do stuff:

source.onmessage = function(event) { get(event.data) do stuff }

however if I leave the webpage; and return to the web page again, or open up the web page in another browser the event is no longer occurring on the newly opened page.

How do I make it so if I return to the same page that I will continue to get the output of the server sent event until the server sent event completes itself?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda