aboutsummaryrefslogtreecommitdiff
path: root/plugin
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
parent520fa4986eba954cba5d3a0ffa6f3697edba5047 (diff)
downloadperl-software-in-gnu-guix-07c2355604ad52103ff95d481252c1ef8086241e.tar
perl-software-in-gnu-guix-07c2355604ad52103ff95d481252c1ef8086241e.tar.gz
support for standalone multiplexing
Diffstat (limited to 'plugin')
-rw-r--r--plugin/multiplex/index.js10
-rw-r--r--plugin/multiplex/package.json19
2 files changed, 28 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) {
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"
+}