Commits

ronald martinez committed 7a3b02f

x

  • Participants

Comments (0)

Files changed (3)

+web: node server.js
+{
+  "name": "node-example",
+  "version": "0.0.1",
+  "dependencies": {
+    "express": "2.5.x",
+    "socket.io": "0.8.x"
+  },
+  "engines": {
+    "node": "0.8.x",
+    "npm": "1.1.x"
+  }
+}
+var port = process.env.PORT || 5000;
+var socket = require('socket.io')
+var io = socket.listen(port);
+
+io.configure(function () { 
+  server.set("transports", ["xhr-polling"]); 
+  server.set("polling duration", 10); 
+});
+
+io.sockets.on("connection", function(message){
+    message.on("newMessage", function(data){
+        io.sockets.emit("sendEvent", data);
+    });
+});