diff --git a/src/connection-pool.js b/src/connection-pool.js index 5abcddc84..61bdb9bed 100644 --- a/src/connection-pool.js +++ b/src/connection-pool.js @@ -288,7 +288,7 @@ ConnectionPool.prototype.createMessage = function(connectionId, resp) { var milliseconds = parseInt(pt.nanos, 10) / 1e6; var originalDataLength = resp.message.data.length; - return { + var message = { connectionId: connectionId, ackId: resp.ackId, id: resp.message.messageId, @@ -300,13 +300,14 @@ ConnectionPool.prototype.createMessage = function(connectionId, resp) { get length() { return originalDataLength; }, - ack: function() { - self.subscription.ack_(this); - }, - nack: function() { - self.subscription.nack_(this); - }, }; + message.ack = function() { + self.subscription.ack_(message); + }; + message.nack = function() { + self.subscription.nack_(message); + }; + return message; }; /*!