Skip to content

Instantly share code, notes, and snippets.

@gtindo
Created March 5, 2020 11:10
Show Gist options
  • Save gtindo/608b26285c3162d771655608b5933163 to your computer and use it in GitHub Desktop.
Save gtindo/608b26285c3162d771655608b5933163 to your computer and use it in GitHub Desktop.
XMPP stanzas
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