socket.io-amqp
Advanced tools
Comparing version 0.1.2 to 0.2.0
19
index.js
@@ -46,4 +46,9 @@ /* | ||
* @param {String} opts Options for the connection. | ||
* @param {function} callback If your code needs to wait until the adapter has fully connected to the AMQP server, you can provide this callback function | ||
* which will get called when its ready. It will also get called with any errors. | ||
* @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 | ||
* callback should be in the form of function(err, nsp), where err is | ||
* the error, and nsp is the namespace. If your code needs to wait until | ||
* sockets.io is fully set up and ready to go, you can use this. | ||
* | ||
@@ -58,3 +63,3 @@ * Following options are accepted: | ||
function adapter (uri, opts, callback) | ||
function adapter (uri, opts, onNamespaceInitializedCallback) | ||
{ | ||
@@ -188,5 +193,5 @@ opts = opts || {}; | ||
console.error("Error in socket.io-amqp: " + err.toString()); | ||
if(callback) | ||
if(onNamespaceInitializedCallback) | ||
{ | ||
return callback(err); | ||
return onNamespaceInitializedCallback(err, nsp); | ||
} | ||
@@ -197,5 +202,5 @@ }); | ||
{ | ||
if(callback) | ||
if(onNamespaceInitializedCallback) | ||
{ | ||
return callback(); | ||
return onNamespaceInitializedCallback(null, nsp); | ||
} | ||
@@ -202,0 +207,0 @@ }); |
{ | ||
"name": "socket.io-amqp", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "A Sockets.IO Adapter for AMQP & RabbitMQ", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -16,3 +16,3 @@ # socket.io-amqp | ||
### adapter(uri[, opts]) | ||
### adapter(uri[, opts], [onNamespaceInitializedCallback]) | ||
@@ -27,4 +27,6 @@ `uri` is a string like `amqp://localhost` which points to your AMQP / RabbitMQ server. | ||
- `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 callback should be in the form of function(err, nsp), where err is the error, and nsp is the namespace. If your code needs to wait until sockets.io is fully set up and ready to go, you can use this. | ||
This is a direct port of socket.io-redis except with all code modified for use with amqplib. | ||
28115
505
31