Skip to content

Instantly share code, notes, and snippets.

@barmgeat
Created June 27, 2019 15:02
Show Gist options
  • Save barmgeat/071004c4a9772fc81909c27144f36131 to your computer and use it in GitHub Desktop.
Save barmgeat/071004c4a9772fc81909c27144f36131 to your computer and use it in GitHub Desktop.
const app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http);
const hostname = '192.168.56.1';
const port = 3001;
app.get('/', (req, res) =>{
res.sendFile(__dirname+'/server.html');
});
io.on('connection', function(socket){
//just testing
console.log('a user connected');
//just testing
socket.on('disconnect', function(){
console.log('user disconnected');
});
});
http.listen(port, hostname, () =>{
console.log(`Server running at http://${hostname}:${port}/`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment