Skip to content

Instantly share code, notes, and snippets.

@milingo
Last active June 15, 2017 14:49
Show Gist options
  • Save milingo/c143b076c8c7d0ef1179e52035b62cb1 to your computer and use it in GitHub Desktop.
Save milingo/c143b076c8c7d0ef1179e52035b62cb1 to your computer and use it in GitHub Desktop.
const http = require('http');
const SocketIO = require('socket.io')
const server = http.createServer(function (req, res) {
...
});
const io = SocketIO(server);
io.on('connection', (socket) => {
socket.emit('tic', { seconds: 0 });
socket.on('tac', (data) => console.log(data));
});
server.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment