From 07c2355604ad52103ff95d481252c1ef8086241e Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Thu, 7 Apr 2016 10:24:44 +0200 Subject: [PATCH] support for standalone multiplexing --- plugin/multiplex/index.js | 10 +++++++++- plugin/multiplex/package.json | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 plugin/multiplex/package.json diff --git a/plugin/multiplex/index.js b/plugin/multiplex/index.js index 40c1661..8195f04 100644 --- a/plugin/multiplex/index.js +++ b/plugin/multiplex/index.js @@ -31,7 +31,15 @@ io.on( 'connection', function( socket ) { app.get("/", function(req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); - fs.createReadStream(opts.baseDir + '/index.html').pipe(res); + + var stream = fs.createReadStream(opts.baseDir + '/index.html'); + stream.on('error', function( error ) { + res.write('

reveal.js multiplex server.

Generate token'); + res.end(); + }); + stream.on('readable', function() { + stream.pipe(res); + }); }); app.get("/token", function(req,res) { diff --git a/plugin/multiplex/package.json b/plugin/multiplex/package.json new file mode 100644 index 0000000..368bfd6 --- /dev/null +++ b/plugin/multiplex/package.json @@ -0,0 +1,19 @@ +{ + "name": "reveal-js-multiplex", + "version": "1.0.0", + "description": "reveal.js multiplex server", + "homepage": "http://lab.hakim.se/reveal-js", + "scripts": { + "start": "node index.js" + }, + "engines": { + "node": "~4.1.1" + }, + "dependencies": { + "express": "~4.13.3", + "grunt-cli": "~0.1.13", + "mustache": "~2.2.1", + "socket.io": "~1.3.7" + }, + "license": "MIT" +}