Total.js Platform
Total.js Platform

Total.js Platform news and tutorials

MJPEG streaming through HTTP in Node.js / Total.js

MJPEG (HTTP) streaming in Node.js / Total.js

Streaming of MJPEG is effortless in the Total.js framework. So you need to receive the buffer with the JPEG image from your e.g., IP camera.

Create a controller /controllers/mjpeg.js:

Receiving MJPEG buffer and resend to all clients

You will need to declare your source from where you obtain MJPEG data. This is only an example, how to send MJPEG buffer to all web clients:

Usage on client-side (HTML)

Good to know

  • /mjpeg/ endpoint keeps open all connections
  • easy to convert this code to WebSocket