Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Project: KOB1
Views: 16973var http = require('http');1var express = require('express');2var fs = require('fs');3var io = require('socket.io');4var Mustache = require('mustache');56var app = express();7var staticDir = express.static;8var server = http.createServer(app);910io = io(server);1112var opts = {13port : 1947,14baseDir : __dirname + '/../../'15};1617io.on( 'connection', function( socket ) {1819socket.on( 'new-subscriber', function( data ) {20socket.broadcast.emit( 'new-subscriber', data );21});2223socket.on( 'statechanged', function( data ) {24delete data.state.overview;25socket.broadcast.emit( 'statechanged', data );26});2728socket.on( 'statechanged-speaker', function( data ) {29delete data.state.overview;30socket.broadcast.emit( 'statechanged-speaker', data );31});3233});3435[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) {36app.use( '/' + dir, staticDir( opts.baseDir + dir ) );37});3839app.get('/', function( req, res ) {4041res.writeHead( 200, { 'Content-Type': 'text/html' } );42fs.createReadStream( opts.baseDir + '/index.html' ).pipe( res );4344});4546app.get( '/notes/:socketId', function( req, res ) {4748fs.readFile( opts.baseDir + 'plugin/notes-server/notes.html', function( err, data ) {49res.send( Mustache.to_html( data.toString(), {50socketId : req.params.socketId51}));52});5354});5556// Actually listen57server.listen( opts.port || null );5859var brown = '\033[33m',60green = '\033[32m',61reset = '\033[0m';6263var slidesLocation = 'http://localhost' + ( opts.port ? ( ':' + opts.port ) : '' );6465console.log( brown + 'reveal.js - Speaker Notes' + reset );66console.log( '1. Open the slides at ' + green + slidesLocation + reset );67console.log( '2. Click on the link in your JS console to go to the notes page' );68console.log( '3. Advance through your slides and your notes will advance automatically' );697071