so://phie

outline

A web-based drawing app
git clone git://soophie.de/outline

blob: b442844315da2707213f5f7408b56bbf9cde2526 (649 bytes)[doc][blame][raw]

1const express = require('express');

2const app = express();

3const http = require('http').createServer(app);

4const io = require('socket.io')(http);

5

6let port = 80;

7

8app.use(express.static(__dirname + '/public'));

9

10const proxy = http.listen(port, function() {

11 console.log('Server started on port: ' + port);

12});

13

14io.path('/pipe');

15io.listen(proxy);

16

17io.on('connection', function(socket) {

18

19 socket.on('data' , function(data) {

20 socket.broadcast.emit('data', data);

21 });

22 socket.on('clear' , function(data) {

23 socket.broadcast.emit('clear', data);

24 });

25 socket.on('background' , function(data) {

26 socket.broadcast.emit('background', data);

27 });

28});