bramqp
Advanced tools
Comparing version 0.1.9 to 0.1.10
@@ -5,7 +5,8 @@ # Other Handle Functions | ||
#### handle.openAMQPCommunication(username, password, heartbeat, callback(error)) | ||
#### handle.openAMQPCommunication(username, password, heartbeat, vhost, callback(error)) | ||
- `username` The username used to log into AMQPLAIN. | ||
- `password` The password used to log into AMQPLAIN. | ||
- `heartbeat` A boolean which controls if heartbeats are enabled. If set to true, heartbeats are sent at the time suggested by the server. | ||
- `username` The username used to log into AMQPLAIN. Defaults to `'guest'`. | ||
- `password` The password used to log into AMQPLAIN. Defaults to `'guest'`. | ||
- `heartbeat` A boolean which controls if heartbeats are enabled. If set to true, heartbeats are sent at the time suggested by the server. Defaults to `true`. | ||
- `vhost` The vhost used to open the connection. Defaults to `'/'`. | ||
- `callback(error)` Called once the content has been written to the socket. | ||
@@ -17,3 +18,3 @@ | ||
- tune the connection and optionally enable heartbeats | ||
- open the '/' vhost | ||
- open the vhost provided | ||
- open channel 1 | ||
@@ -20,0 +21,0 @@ - channel 1 will re-open if closed by the server |
@@ -135,5 +135,28 @@ var util = require('util'); | ||
ConnectionHandle.prototype.openAMQPCommunication = function(username, password, heartbeat, callback) { | ||
ConnectionHandle.prototype.openAMQPCommunication = function() { | ||
var self = this; | ||
var args = Array.prototype.slice.call(arguments); | ||
var username = 'guest'; | ||
var password = 'guest'; | ||
var heartbeat = true; | ||
var vhost = '/'; | ||
var callback; | ||
if (args.length && typeof args[args.length - 1] === 'function') { | ||
callback = args.pop(); | ||
} | ||
if (args.length) { | ||
username = args.shift(); | ||
} | ||
if (args.length) { | ||
password = args.shift(); | ||
} | ||
if (args.length) { | ||
heartbeat = args.shift(); | ||
} | ||
if (args.length) { | ||
vhost = args.shift(); | ||
} | ||
async.series([ | ||
@@ -300,2 +323,2 @@ function(seriesCallback) { | ||
this.socket.write(frameBuffer.slice(0, frameBuffer.used), 'utf8', callback); | ||
}; | ||
}; |
{ | ||
"name" : "bramqp", | ||
"version" : "0.1.9", | ||
"version" : "0.1.10", | ||
"description" : "bakkerthehacker's rapid AMQP library", | ||
@@ -5,0 +5,0 @@ "keywords" : [ "amqp", "bramqp" ], |
@@ -5,3 +5,3 @@ # bakkerthehacker's rapid AMQP library | ||
[![NPM version](https://badge.fury.io/js/bramqp.png)](http://badge.fury.io/js/bramqp) | ||
[![NPM version](https://badge.fury.io/js/bramqp.png)](https://npmjs.org/package/bramqp) | ||
[![Build Status](https://travis-ci.org/bakkerthehacker/bramqp.png?branch=master)](https://travis-ci.org/bakkerthehacker/bramqp) | ||
@@ -8,0 +8,0 @@ [![Dependency Status](https://david-dm.org/bakkerthehacker/bramqp.png?theme=shields.io)](https://david-dm.org/bakkerthehacker/bramqp) |
251882
3513