Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

318
Vistas
Extracting data from multipart/x-mixed-replace content-type

If I do have the velow html5 element:

<div>
    Counter: <span id="content"></span>
</div>

And my server is returning a counter, I can listen to this counter, and display it at the above element as:

var source = new EventSource("http://localhost:8080/counter");
   source.onmessage = function (event) {
   var data = JSON.parse(event.data);
   document.getElementById("content").innerHTML = counter;
}

But what if the server is sending me a multipart/x-mixed-replace, how can I receive it in the JavaScript code, and display its content in a div or 'objector evenimage`, the server is expected to send me multiple images that can be displayed as video streaming.

I saw this but could not understand how to do it in JavaScript at browser.

Pure JavaScript please.

Note: I was able to do it as:

<object data="http://localhost:8080/camera" width="300" height="200" alt="Cam streaming"></object>

But I prefer using SSE (Server-Sent-Event) to do it.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda