Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiwajshing committed Mar 16, 2020
1 parent 3e1142a commit 9a963f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions WhatsAppWeb.Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ module.exports = function (WhatsAppWeb) {
}
}, 25 * 1000)
}
// disconnect from the phone. Your auth credentials become invalid after sending a disconnect request.
// use close() if you just want to close the connection
WhatsAppWeb.prototype.disconnect = function () {
if (this.status === Status.connected) {
this.conn.send('goodbye,["admin","Conn","disconnect"]', null, () => {
Expand All @@ -177,6 +179,7 @@ module.exports = function (WhatsAppWeb) {
this.close()
}
}
// close the connection
WhatsAppWeb.prototype.close = function () {
this.conn.close()
this.conn = null
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const readline = require('readline').createInterface({
})
readline.question("type exit to disconnect\n", (txt) => {
if (txt === "exit") {
client.disconnect()
client.close()
process.exit(0)
}
})

0 comments on commit 9a963f4

Please sign in to comment.