From 0a5dde3dcd855bc137d7f3ccfcbb8ec8b774ff17 Mon Sep 17 00:00:00 2001 From: Saar Yahalom Date: Sun, 22 Dec 2019 22:32:13 +0200 Subject: [PATCH 1/2] Add support to pass amqpConnectionOptions through init options --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index daf1430..2941185 100644 --- a/index.js +++ b/index.js @@ -50,6 +50,7 @@ module.exports = adapter; * @param {String} [opts.channelSeperator='#'] * @param {String} [opts.prefix=''] * @param {Boolean} [opts.useInputExchange=false] + * @param {Object} [opts.amqpConnectionOptions={}] * @param {function} onNamespaceInitializedCallback This is a callback function that is called everytime sockets.io opens a * new namespace. Because a new namespace requires new queues and exchanges, * you can get a callback to indicate the success or failure here. This @@ -72,7 +73,8 @@ function adapter(uri, opts, onNamespaceInitializedCallback) queueName: '', channelSeperator: '#', prefix: '', - useInputExchange: false + useInputExchange: false, + amqpConnectionOptions: {}, }); const prefix = opts.prefix; @@ -88,7 +90,7 @@ function adapter(uri, opts, onNamespaceInitializedCallback) { Adapter.call(this, nsp); - const amqpConnectionOptions = {}; + const amqpConnectionOptions = opts.amqpConnectionOptions; const amqpExchangeOptions = { durable: true, From ac52e867cad792ac5df66d41159cd40a0e83e386 Mon Sep 17 00:00:00 2001 From: Saar Yahalom Date: Tue, 24 Dec 2019 13:59:03 +0200 Subject: [PATCH 2/2] Fix typo --- index.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 2941185..084e342 100644 --- a/index.js +++ b/index.js @@ -47,7 +47,7 @@ module.exports = adapter; * @param {String} uri AMQP uri * @param {Object} opts Options for the connection. * @param {String} [opts.queueName=''] - * @param {String} [opts.channelSeperator='#'] + * @param {String} [opts.channelSeparator='#'] * @param {String} [opts.prefix=''] * @param {Boolean} [opts.useInputExchange=false] * @param {Object} [opts.amqpConnectionOptions={}] @@ -71,7 +71,7 @@ function adapter(uri, opts, onNamespaceInitializedCallback) underscore.defaults(opts, { queueName: '', - channelSeperator: '#', + channelSeparator: '#', prefix: '', useInputExchange: false, amqpConnectionOptions: {}, @@ -394,7 +394,7 @@ function adapter(uri, opts, onNamespaceInitializedCallback) function getChannelName() { - return Array.prototype.join.call(arguments, opts.channelSeperator) + opts.channelSeperator; + return Array.prototype.join.call(arguments, opts.channelSeparator) + opts.channelSeparator; } return AMQPAdapter; diff --git a/package.json b/package.json index 36f54a9..6bbbb43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "socket.io-amqp", - "version": "2.0.0", + "version": "2.0.1", "description": "A Sockets.IO Adapter for AMQP & RabbitMQ", "main": "lib/main.js", "directories": {