Created
October 12, 2016 02:57
-
-
Save suissa/c99eec4106150da070caf20500915e3b 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 http = require('http') | |
const fs = require('fs') | |
const index = fs.readFileSync('./04.html'); | |
const app = http.createServer((req, res) => { | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
res.end(index); | |
}).listen(8080) | |
const io = require('socket.io').listen(app) | |
io.on('connection', (socket) => { | |
console.log('conexão com o Socket.io') | |
socket.on('disconnect', () => { | |
console.log('disconnect no socket') | |
}) | |
socket.on('connect-client', (data) => { | |
const d1 = new Date(data) | |
console.log('connect do client em', d1.toGMTString()) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment