Created
          June 27, 2019 15:02 
        
      - 
      
- 
        Save barmgeat/071004c4a9772fc81909c27144f36131 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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