Comparing version 0.11.2 to 0.12.0
@@ -123,3 +123,3 @@ "use strict"; | ||
this.socket.send( | ||
EJSON.stringify(data) | ||
EJSON.stringify(data) | ||
); | ||
@@ -153,3 +153,3 @@ }; | ||
// method result | ||
// method result | ||
} else if (data.msg === "result") { | ||
@@ -169,3 +169,3 @@ var cb = self._callbacks[data.id]; | ||
// method updated | ||
// method updated | ||
} else if (data.msg === "updated") { | ||
@@ -181,3 +181,3 @@ | ||
// missing subscription | ||
// missing subscription | ||
} else if (data.msg === "nosub") { | ||
@@ -191,3 +191,3 @@ var cb = self._callbacks[data.id]; | ||
// add document to collection | ||
// add document to collection | ||
} else if (data.msg === "added") { | ||
@@ -215,3 +215,3 @@ if (self.maintainCollections && data.collection) { | ||
// remove document from collection | ||
// remove document from collection | ||
} else if (data.msg === "removed") { | ||
@@ -236,3 +236,3 @@ if (self.maintainCollections && data.collection) { | ||
// change document in collection | ||
// change document in collection | ||
} else if (data.msg === "changed") { | ||
@@ -246,10 +246,10 @@ if (self.maintainCollections && data.collection) { | ||
var oldFields = {}, | ||
clearedFields = data.cleared || [], | ||
newFields = {}; | ||
clearedFields = data.cleared || [], | ||
newFields = {}; | ||
if (data.fields) { | ||
_.each(data.fields, function(value, key) { | ||
oldFields[key] = self.collections[name][id][key]; | ||
newFields[key] = value; | ||
self.collections[name][id][key] = value; | ||
oldFields[key] = self.collections[name][id][key]; | ||
newFields[key] = value; | ||
self.collections[name][id][key] = value; | ||
}); | ||
@@ -260,3 +260,3 @@ } | ||
_.each(data.cleared, function(value) { | ||
delete self.collections[name][id][value]; | ||
delete self.collections[name][id][value]; | ||
}); | ||
@@ -272,3 +272,3 @@ } | ||
// subscriptions ready | ||
// subscriptions ready | ||
} else if (data.msg === "ready") { | ||
@@ -283,6 +283,6 @@ _.each(data.subs, function(id) { | ||
// minimal heartbeat response for ddp pre2 | ||
// minimal heartbeat response for ddp pre2 | ||
} else if (data.msg === "ping") { | ||
self._send( | ||
_.has(data, "id") ? { msg : "pong", id : data.id } : { msg : "pong" } | ||
_.has(data, "id") ? { msg : "pong", id : data.id } : { msg : "pong" } | ||
); | ||
@@ -317,4 +317,5 @@ } | ||
*/ | ||
DDPClient.prototype.connect = function() { | ||
DDPClient.prototype.connect = function(callback) { | ||
var self = this; | ||
self._reconnectCallback = self._reconnectCallback || callback; | ||
@@ -335,2 +336,5 @@ return new Promise(function (resolve, reject) { | ||
self._clearReconnectTimeout(); | ||
if (self._reconnectCallback) { | ||
self._reconnectCallback(null, self._isReconnecting); | ||
} | ||
resolve(self._isReconnecting); | ||
@@ -345,2 +349,5 @@ self._isConnecting = false; | ||
self._connectionFailed = true; | ||
if (self._reconnectCallback) { | ||
self._reconnectCallback(error, self._isReconnecting); | ||
} | ||
reject(error); | ||
@@ -395,3 +402,10 @@ }; | ||
} else if (body) { | ||
var info = JSON.parse(body); | ||
var info; | ||
try { | ||
info = JSON.parse(body); | ||
} catch(exception) { | ||
info = {base_url : ''}; | ||
console.log('=> Your Meteor application has errors. Waiting for file change.') | ||
} | ||
if(!info.base_url) { | ||
@@ -468,3 +482,3 @@ // no base_url, then use pure WS handling | ||
var self = this, | ||
updatedCallback = null; | ||
updatedCallback = null; | ||
@@ -471,0 +485,0 @@ if (typeof arguments[arguments.length - 1] === 'function') { |
{ | ||
"name": "xolvio-ddp", | ||
"version": "0.11.2", | ||
"version": "0.12.0", | ||
"description": "Node.js module to connect to servers using DDP protocol.", | ||
@@ -24,3 +24,3 @@ "author": "Tom Coleman <tom@thesnail.org> (http://tom.thesnail.org)", | ||
"type": "git", | ||
"url": "https://github.com/oortcloud/node-ddp-client.git" | ||
"url": "https://github.com/xolvio/node-ddp-client" | ||
}, | ||
@@ -45,3 +45,3 @@ "dependencies": { | ||
}, | ||
"bugs": "https://github.com/oortcloud/node-ddp-client/issues" | ||
"bugs": "https://github.com/xolvio/node-ddp-client/issues" | ||
} |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
1003
51452
18