Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

Commit c34a952

Browse files
author
Joshua Rubin
committed
add support for client-id on connect
Signed-off-by: Joshua Rubin <jrubin@zvelo.com>
1 parent 82442ea commit c34a952

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/stomp.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,16 @@ function _connect(stomp) {
118118
function _setupListeners(stomp) {
119119
function _connected() {
120120
log.debug('Connected to socket');
121+
var headers = {};
121122
if (utils.really_defined(stomp.login) &&
122123
utils.really_defined(stomp.passcode)) {
123-
stomp_connect(stomp, {login: stomp.login, passcode: stomp.passcode});
124-
} else {
125-
stomp_connect(stomp);
124+
headers.login = stomp.login;
125+
headers.passcode = stomp.passcode;
126126
}
127+
if (utils.really_defined(stomp["client-id"])) {
128+
headers["client-id"] = stomp["client-id"];
129+
}
130+
stomp_connect(stomp, headers);
127131
}
128132

129133
var socket = stomp.socket;
@@ -236,15 +240,15 @@ function Stomp(args) {
236240
this.ssl = args['ssl'] ? true : false;
237241
this.ssl_validate = args['ssl_validate'] ? true : false;
238242
this.ssl_options = args['ssl_options'] || {};
243+
this['client-id'] = args['client-id'] || null;
239244
};
240245

241246
Stomp.prototype = new process.EventEmitter();
242247

243248
/**
244249
* Begin connection
245-
* @param {Object} optional headers
246250
*/
247-
Stomp.prototype.connect = function(headers) {
251+
Stomp.prototype.connect = function() {
248252
var self = this;
249253
_connect(self);
250254
};

0 commit comments

Comments
 (0)