Created
March 5, 2020 11:10
-
-
Save gtindo/608b26285c3162d771655608b5933163 to your computer and use it in GitHub Desktop.
XMPP stanzas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { xml } = require('@xmpp/client'); | |
function simpleMessage(to, from, type, message){ | |
return xml( | |
"message", | |
{to, from, type}, | |
xml("body", {},message) | |
) | |
} | |
function threadMessage(to, from, type, threadId, message){ | |
return xml( | |
"message", | |
{to, from, type}, | |
xml("body", {}, message), | |
xml("thread", {}, threadId) | |
) | |
} | |
function presence(to, from, type){ | |
return xml( | |
"presence", | |
{type, from, to} | |
) | |
} | |
console.log(presence("romeo@presence", "test@presence", "probe").toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment