Commits

ronald martinez committed c08b214

sd

  • Participants
  • Parent commits 75d1785

Comments (0)

Files changed (1)

 express = require('express')
+socketio = require('socket.io')
 
 app = express.createServer();
 
+var io = socketio.listen(app)
 var port = process.env.PORT || 5000;
 
-/*
-var io = require('socket.io').listen(port);
-
-io.sockets.on('connection', function (socket) {
-  socket.emit('news', { hello: 'world' });
-  socket.on('my other event', function (data) {
-    console.log(data);
-  });
-});
-*/
-
-var io = require('socket.io').listen(app)
-
 io.configure(function () { 
   io.set("transports", ["xhr-polling"]); 
   io.set("polling duration", 10); 
 
 io.sockets.on("connection", function(socket){
     socket.on("newMessage", function(data){
-        //socket.emit("sendEvent", data);
-        socket.broadcast.emit('sendEvent', data);
+        io.sockets.emit('sendEvent', data)
     });
 });