aboutsummaryrefslogtreecommitdiff
path: root/plugin/multiplex/index.js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2016-04-07 10:24:44 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2016-04-07 10:24:44 +0200
commit07c2355604ad52103ff95d481252c1ef8086241e (patch)
tree874bf9d6e550fd053256da9ce3302661bc7cd0cd /plugin/multiplex/index.js
parent520fa4986eba954cba5d3a0ffa6f3697edba5047 (diff)
downloadfosdem-2018-presentation-07c2355604ad52103ff95d481252c1ef8086241e.tar
fosdem-2018-presentation-07c2355604ad52103ff95d481252c1ef8086241e.tar.gz
support for standalone multiplexing
Diffstat (limited to 'plugin/multiplex/index.js')
-rw-r--r--plugin/multiplex/index.js10
1 files changed, 9 insertions, 1 deletions
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('<style>body{font-family: sans-serif;}</style><h2>reveal.js multiplex server.</h2><a href="/token">Generate token</a>');
+ res.end();
+ });
+ stream.on('readable', function() {
+ stream.pipe(res);
+ });
});
app.get("/token", function(req,res) {