Basically, you just need to create a client, and then send a formatted chunk of XML representing the message. The spec here has the details on what that XML should look like, and ltx is used to create that element.
-
-
Save 8bitDesigner/5338949 to your computer and use it in GitHub Desktop.
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
var XMPP = require('node-xmpp') | |
var client = new XMPP.Client( | |
{ boshURL: "https://beta.buddycloud.org/http-bind/" | |
, jid: '[email protected]' | |
, password: 'xxxxxxxxxxx' | |
} | |
); | |
client.on = client.addListener | |
function Message(to, body) { | |
var message = new XMPP.Element('message', {to: to, type: 'chat'}) | |
return message.c('body').t(body) | |
} | |
client.on('online', function() { | |
client.send(new Message("[email protected]", "Oh hai!")) | |
client.end() // nodejs has nothing left to do and will exit | |
}) | |
client.on('error', function(e) { | |
console.error(e) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes - I'm using a BOSH transport here, ideally the next step is to shove this in browserify and supply the XMPP lib that way.