Skip to content

Instantly share code, notes, and snippets.

@A-d-i-t-h-y-a-n
Forked from PurpShell/monitor.js
Last active August 2, 2024 16:05
Show Gist options
  • Save A-d-i-t-h-y-a-n/36637f6d8b99664f6a46073318e06f91 to your computer and use it in GitHub Desktop.
Save A-d-i-t-h-y-a-n/36637f6d8b99664f6a46073318e06f91 to your computer and use it in GitHub Desktop.
Monitor Socket messages on 2.3000x and above
if (!window.decodeBackStanza) {
window.decodeBackStanza = require("WAWap").decodeStanza;
window.encodeBackStanza = require("WAWap").encodeStanza;
}
require("WAWap").decodeStanza = async (e, t) => {
const result = await window.decodeBackStanza(e, t);
console.log('[INFO] coming from whatsapp, tag:' + result.tag + ' , xmlns:' + result.attrs?.xmlns + ' , type:' + result.attrs?.type, JSON.stringify(result, undefined, 2));
return result;
}
require("WAWap").encodeStanza = (...args) => {
const result = window.encodeBackStanza(...args);
console.log('[INFO] going to whatsapp, tag:' + args[0].tag + ' , xmlns:' + args[0].attrs?.xmlns + ' , type:' + args[0].attrs?.type, JSON.stringify(args[0], undefined, 2));
return result;
}
@A-d-i-t-h-y-a-n
Copy link
Author

just do .toString()

Aah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment