Created
April 4, 2018 20:08
-
-
Save jaouadballat/455aa46fd714a16511584d469e58ad36 to your computer and use it in GitHub Desktop.
This file contains 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 express = require('express'); | |
const app = express(); | |
const server = app.listen(3001, function() { | |
console.log('server running on port 3001'); | |
}); | |
const io = require('socket.io')(server); | |
io.on('connection', function(socket) { | |
console.log(socket.id) | |
socket.on('SEND_MESSAGE', function(data) { | |
io.emit('MESSAGE', data) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment