From 10bd4fe8faf3f206b64bcdf714eb34045a20106f Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Thu, 4 Jul 2013 15:34:18 +0100 Subject: [PATCH] Send client properties --- lib/api.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/api.js b/lib/api.js index 6d0c7619..a977c403 100644 --- a/lib/api.js +++ b/lib/api.js @@ -9,6 +9,21 @@ var QS = require('querystring'); var defer = require('when').defer; var Connection = require('./connection').Connection; var clone = require('util')._extend.bind(null, {}); +var fmt = require('util').format; + +var CLIENT_PROPERTIES = { + "product": "amqplib", + "version": require('../package.json').version, + "platform": fmt('Node.JS %s', process.version), + "information": "http://squaremo.github.io/amqp.node", + "capabilities": { + "publisher_confirms": true, + "exchange_exchange_bindings": true, + "basic.nack": true, + "consumer_cancel_notify": false + } +}; + // Parse a URL to get the options used in the opening protocol function openOptionsFromURL(parts) { @@ -33,7 +48,7 @@ function openOptionsFromURL(parts) { return { // start-ok - 'clientProperties': {}, + 'clientProperties': CLIENT_PROPERTIES, 'mechanism': 'PLAIN', 'response': new Buffer(['', user, passwd].join(String.fromCharCode(0))), 'locale': q.locale || 'en_US', @@ -53,7 +68,7 @@ function openOptionsFromURL(parts) { function connect(url, socketOptions) { // tls.connect uses `util._extend()` on the options given it, which // copies only properties mentioned in `Object.keys()`, when - // processing the options. So I have to makes copies too, rather + // processing the options. So I have to make copies too, rather // than using `Object.create()`. var sockopts = clone(socketOptions || {}); url = url || 'amqp://localhost';