Skip to content

Instantly share code, notes, and snippets.

@andrebaltieri
Created July 9, 2015 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrebaltieri/63366ebffe710363b6e5 to your computer and use it in GitHub Desktop.
Save andrebaltieri/63366ebffe710363b6e5 to your computer and use it in GitHub Desktop.
/// <reference path="typings/node/node.d.ts"/>
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
io.on('connection', function(socket){
socket.on('message', function(msg){
io.emit('message', msg);
});
});
http.listen(5002, function(){
console.log('Servidor ouvindo na porta 5002');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment