Skip to content

Instantly share code, notes, and snippets.

@cranic
Last active August 29, 2015 14:00
Show Gist options
  • Save cranic/11100399 to your computer and use it in GitHub Desktop.
Save cranic/11100399 to your computer and use it in GitHub Desktop.
var express = require('express');
var socketio = require('socket.io');
var http = require('http');
var app = express();
var server = http.createServer(app);
var io = socketio.listen(server);
app.get('/', function(req, res){
res.send('Hello world');
});
io.sockets.on('connection', function(socket){
console.log('Socket conectado');
socket.on('msg', function(data){
console.log('Recebi msg', data);
});
});
server.listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment