diff --git a/lib/native/index.js b/lib/native/index.js index 1b79488e..dd708be0 100644 --- a/lib/native/index.js +++ b/lib/native/index.js @@ -51,8 +51,6 @@ Client.prototype.connect = function(cb) { //set internal states to connected self._connected = true; - self.emit('connect'); - self._pulseQueryQueue(true); //handle connection errors from the native layer self.native.on('error', function(err) { @@ -70,6 +68,10 @@ Client.prototype.connect = function(cb) { }); }); + //signal we are connected now + self.emit('connect'); + self._pulseQueryQueue(true); + //possibly call the optional callback if(cb) cb(); });