Last active
November 2, 2017 00:55
-
-
Save AntonioErdeljac/d2ee46093d8e54b29af230e68b8cf99b 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
var express = require('express'); | |
var socket = require('socket.io'); | |
var app = express(); | |
server = app.listen(8080, function(){ | |
console.log('server is running on port 8080') | |
}); | |
io = socket(server); | |
io.on('connection', (socket) => { | |
console.log(socket.id); | |
socket.on('SEND_MESSAGE', function(data){ | |
io.emit('RECEIVE_MESSAGE', data); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment