aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/index.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/index.js b/src/server/index.js
index 2b85ea5..f8b5ca7 100644
--- a/src/server/index.js
+++ b/src/server/index.js
@@ -1,11 +1,19 @@
const express = require('express');
-const path = require('path');
const app = express();
+const http = require('http').Server(app);
+const path = require('path');
+const io = require('socket.io')(http);
app.use(express.static(path.join(__dirname, '../../build')));
+io.on('connection', (socket) => {
+ socket.on('update-remote-board', (board) => {
+ io.emit('update-client-board', board)
+ })
+});
+
// Start the server
const PORT = process.env.PORT || 5000;
-app.listen(PORT, () => {
+http.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
});