mirror of
https://github.com/alee14-projects/Project-Hexus.git
synced 2025-01-22 16:06:09 -05:00
21 lines
No EOL
497 B
JavaScript
21 lines
No EOL
497 B
JavaScript
var app = require('express')();
|
|
var http = require('http').Server(app);
|
|
var io = require('socket.io')(http);
|
|
|
|
app.get('/', function(req, res){
|
|
res.sendFile('client/index.html');
|
|
});
|
|
|
|
io.on('connection', function(socket){
|
|
console.log('user connected');
|
|
socket.on('chat message', function(msg){
|
|
io.emit('chat message', msg);
|
|
});
|
|
socket.on('disconnect', function(){
|
|
console.log('user disconnected');
|
|
});
|
|
});
|
|
|
|
http.listen(3000, function(){
|
|
console.log('listening on *:3000');
|
|
}); |