Skip to content

Commit cd6cc2c

Browse files
committed
feat: allow an address and object as send args
1 parent de11a78 commit cd6cc2c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ QueueWrapper.prototype.initialiseQueue = function () {
3535
}
3636

3737
// public send function
38-
QueueWrapper.prototype.send = function (message, done) {
38+
QueueWrapper.prototype.send = function (address, data, done) {
39+
let message = ''
40+
if (typeof data === 'function') {
41+
done = data
42+
message = address
43+
} else {
44+
const serializedData = typeof data === 'object' ? JSON.stringify(data) : data
45+
const encodedData = new Buffer(serializedData).toString('base64')
46+
message = address + '|' + encodedData
47+
}
48+
3949
const send = () => {
4050
let options = {
4151
qname: this.options.name,

0 commit comments

Comments
 (0)