diff --git a/lib/stomp.js b/lib/stomp.js index 574ef32..07351f8 100644 --- a/lib/stomp.js +++ b/lib/stomp.js @@ -31,7 +31,7 @@ var net = require('net'), function parse_command(data) { var command, - this_string = data.toString('utf8', start=0, end=data.length); + this_string = data.toString('utf8', 0, data.length); command = this_string.split('\n'); return command[0]; }; @@ -70,9 +70,9 @@ function parse_frame(chunk) { command = parse_command(chunk); data = chunk.slice(command.length + 1, chunk.length); - data = data.toString('utf8', start=0, end=data.length); + data = data.toString('utf8', 0, data.length); - the_rest = data.split('\n\n'); + var the_rest = data.split('\n\n'); headers = parse_headers(the_rest[0]); body = the_rest.slice(1, the_rest.length); @@ -300,7 +300,7 @@ Stomp.prototype.disconnect = function() { * @param {Object} headers */ Stomp.prototype.subscribe = function(headers) { - var self = this; + var self = this, destination = headers['destination']; headers['session'] = self.session; send_command(this, 'SUBSCRIBE', headers); @@ -313,7 +313,7 @@ Stomp.prototype.subscribe = function(headers) { * @param {Object} headers */ Stomp.prototype.unsubscribe = function(headers) { - var self = this; + var self = this, destination = headers['destination']; headers['session'] = self.session; send_command(this, 'UNSUBSCRIBE', headers); @@ -370,8 +370,8 @@ Stomp.prototype.abort = function(transaction_id) { * @return {Object} Frame object of message sent */ Stomp.prototype.send = function(headers, want_receipt) { - var self = this; - destination = headers['destination']; + var self = this, + destination = headers['destination'], body = headers['body'] || null; delete headers['body']; headers['session'] = self.session;