repl.it
Nodejs

No description

fork
loading
Files
  • index.js
  • public
  • datastruct.json
  • Packager files
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const express = require('express')
const app = express();
const server = require('http').Server(app);
const io = require('socket.io')(server);
server.listen(process.env.PORT || 5000);
app.use(express.static('public'));

let arr = [];

io.on('connection', socket => {
	console.log(`New socket: ${socket.id}`);

	socket.on('disconnect', () => {
		console.log("Socket Disconnected.");
	});
});