Skip to content

Instantly share code, notes, and snippets.

@PurpShell
Created May 13, 2024 14:48
Show Gist options
  • Save PurpShell/13f198b996b46e3e783bee1ef06d1a35 to your computer and use it in GitHub Desktop.
Save PurpShell/13f198b996b46e3e783bee1ef06d1a35 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, result);
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, args[0]);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment