Skip to content

Commit

Permalink
added ack constants and brief example
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroslopez committed Feb 27, 2020
1 parent bb4ad11 commit e6ef592
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@ client.on('message_revoke_me', async (msg) => {
console.log(msg.body); // message before it was deleted.
});

client.on('message_ack', (msg, ack) => {
/*
== ACK VALUES ==
ACK_ERROR: -1
ACK_PENDING: 0
ACK_SERVER: 1
ACK_DEVICE: 2
ACK_READ: 3
ACK_PLAYED: 4
*/

if(ack == 3) {
// The message was read
}
});

client.on('disconnected', (reason) => {
console.log('Client was logged out', reason);
});
Expand Down
14 changes: 14 additions & 0 deletions src/util/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,17 @@ exports.WAState = {
UNPAIRED: 'UNPAIRED',
UNPAIRED_IDLE: 'UNPAIRED_IDLE'
};

/**
* Message ACK
* @readonly
* @enum {number}
*/
exports.MESSAGE_ACK = {
ACK_ERROR: -1,
ACK_PENDING: 0,
ACK_SERVER: 1,
ACK_DEVICE: 2,
ACK_READ: 3,
ACK_PLAYED: 4,
};

0 comments on commit e6ef592

Please sign in to comment.