A Node.js compatible version of Strophe.js, borrowed from https://github.com/dhruvbird/node-xmpp-bosh. This is code mostly identical to Strophe.js release 1.0.2.
Please note: All releases from version v2.0.0 onwards have been modified to work with jsdom 6 for compatibility with Node.js 4. jsdom 6 is not compatible with Node.js 0.x. If you're working on Node.js 0.x, use the node-Strophe 1.0.1 release. Also, if you're using jsdom in your own application (for example to load jQuery), the way to use jsdom has been changed. See https://github.com/tmpvar/jsdom.
npm install node-strophe
// Configurationvar server = 'bosh.my-server.com';var jid = 'firstname.lastname@example.org';var password = '';// Requirementsvar strophe = Strophe;var Strophe = stropheStrophe;// Set-up the connectionvar BOSH_SERVICE = 'https://' + server + '/http-bind';var connection = BOSH_SERVICE;// Log XMPPconnectionrawInput = connectionrawOutput = consolelog;// Connectconnection;
See http://strophe.im/strophejs/ for more information on how to use Strophe.js.