Skip to content

Commit 1698f8c

Browse files
committed
Give topic a default value if not supplied
It's possible to use SubSocket#connect without a callback *or* topic, in which case it ought to use an empty string for the topic.
1 parent 907acee commit 1698f8c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/sockets.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ addSocketMethods(SubSocket);
218218
SubSocket.prototype.connect = function(source, topic, callback) {
219219
// Support the general form of connect
220220
if (callback === undefined && typeof topic === 'function') {
221-
callback = topic;
222-
topic = '';
223-
}
221+
callback = topic; topic = '';
222+
} else topic = topic || '';
223+
224224
var ch = this.ch, queue = this.queue, self = this;
225225
ch.assertExchange(source,
226226
this.options.routing || 'fanout',

0 commit comments

Comments
 (0)