Skip to content

Instantly share code, notes, and snippets.

@cs8425
Created December 9, 2013 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cs8425/7869055 to your computer and use it in GitHub Desktop.
Save cs8425/7869055 to your computer and use it in GitHub Desktop.
M-JPG http header
http://stackoverflow.com/questions/2060953/httpwebresponse-with-mjpeg-and-multipart-x-mixed-replace-boundary-myboundary
var BOUNDARY = '----' + Math.random().toString(16).substring(2);
header("Cache-Control: no-cache");
header("Cache-Control: private");
header("Pragma: no-cache");
header("Content-type: multipart/x-mixed-replace; boundary=$boundary");
============================
HTTP/1.1 200 OK
Content-Type: multipart/x-mixed-replace; boundary=--myboundary
--myboundary
Content-Type: image/jpeg
Content-length: 12345
[image 1 encoded jpeg data]
--myboundary
Content-Type: image/jpeg
Content-length: 45678
[image 2 encoded jpeg data]
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment