Skip to content

Instantly share code, notes, and snippets.

@lfcipriani
Created April 19, 2012 03:03
Show Gist options
  • Save lfcipriani/2418095 to your computer and use it in GitHub Desktop.
Save lfcipriani/2418095 to your computer and use it in GitHub Desktop.
real-time-comparison.js 2
// real-time-comparison.js
function onConnect(status)
{
if (status == Strophe.Status.CONNECTING) {
// ... outros status
} else if (status == Strophe.Status.CONNECTED) {
// adding one handler for each type of XMPP stanza
connection.addHandler(onPresence, null, 'presence', null, null, null);
connection.addHandler(onIq, null, 'iq', null, null, null);
connection.addHandler(onMessage, null, 'message', null, null, null);
console.log("Sending presence...");
// app is available to use only after sending and receiving presence from the server
connection.send($pres().tree());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment