misc small bug-fixes

This commit is contained in:
Curtis SerVaas
2014-08-20 13:23:43 -07:00
parent 411a15d39d
commit ecbdca040d
8 changed files with 302 additions and 301 deletions
+6 -6
View File
@@ -20,10 +20,10 @@ module.exports = {
var url = require("../config/config.js").DB_URL;
try { mongoose.connect(url); }
catch(err) { console.log("Error: Sign In to MongoLab") }
}
},
createSocket: function(server) {
io = require('socket.io').listen(server);
io = require('socket.io').listen(server, {log: false});
io.sockets.on('connection', function(socket){
socket.AUTHOR = {}; //anonymous.
@@ -31,6 +31,7 @@ module.exports = {
socket.on("logIn", function(data){
socket.AUTHOR = data;
attachLogInListeners(socket);
console.log("logIn + attachLogInListeners")
});
socket.on('nodeRequest', function(data){
@@ -110,7 +111,6 @@ function attachLogInListeners(socket){
socket.on("newNode", function(data){
//data[0] = [parID, newindex] . data[1] = modelJSON
var modelJson = data[1]; //(includes the negative ID to find later);
var parId = data[0][0];
var newIndex = data[0][1];
@@ -122,15 +122,15 @@ function attachLogInListeners(socket){
socket.emit("updateReceived", [modelJson._id ,instance, data[0]]);
socket.broadcast.emit("newNode", [ [parId,newIndex] , instance ]);
//io.sockets.emit("newNode", [data[0], instance])
//I'm going to have to update the parent Model on this as well...
//(and therefore, broadcast the array...)
Node.updateParent(parId, instance._id ,newIndex, now );
}
console.log("newNode");
Node.addNode(modelJson.text, modelJson.children, modelJson.parents, modelJson.author._id ,callback);
});
//need to broadcast parentArray.
socket.on("removeNode", function(data){
var thisId = data[0];