Skip to content

Commit

Permalink
Send client properties
Browse files Browse the repository at this point in the history
  • Loading branch information
squaremo committed Jul 4, 2013
1 parent b7bfa57 commit 10bd4fe
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/api.js
Expand Up @@ -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) {
Expand All @@ -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',
Expand All @@ -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';
Expand Down

0 comments on commit 10bd4fe

Please sign in to comment.