Wrox Programmer Forums
|
BOOK: Professional XMPP Programming with JavaScript and jQuery
This is the forum to discuss the Wrox book Professional XMPP Programming with JavaScript and jQuery by Jack Moffitt; ISBN: 978-0-470-54071-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XMPP Programming with JavaScript and jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 2nd, 2012, 12:34 PM
Registered User
 
Join Date: Dec 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Issues with strophe register plugin

Dear Metajack,

i try to use the strophe register plugin and i'm facing issues... i commented the lines in the plugin as suggested here:

http://stackoverflow.com/questions/1...openfire-usage

...now this is my code for triggering the connect:

function connect() {
$(document).trigger('connect', {
jid : "[email protected]",
password : "register"
});
}

...and this is the handler method:

$(document).bind('connect', function (ev, data) {

var conn = new Strophe.Connection(MyConnection.url);

var callback = function (status) {
if (status === Strophe.Status.CONNECTED) {
console.log("logged in!");
$(document).trigger('connected');
} else if (status === Strophe.Status.REGISTER) {
console.log("in status register...");
conn.register.fields.username = "register";
conn.register.fields.password = "register";
conn.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
console.log("registered!");
conn.register.authenticate();
}

};

conn.register.connect("maschine", callback, 60, 1);

MyConnection.connection = conn;

});

...this works fine first time...the second time i start the app it tries to register again...why is strophe status "connected" never reached when i start the app again after the successful registration of the account? I did a console.log in the submit-method of the plugin and every time i start the app second time it seems to hang in this method...maybe you can tell me whats wrong with my code?

Before i used the plugin my code looked like this in the handler:

conn.connect(data.jid, data.password, function (status) {
if (status === Strophe.Status.CONNECTED) {
$(document).trigger('connected');
} else if (status === Strophe.Status.DISCONNECTED) {
connect();
}
else if (status === Strophe.Status.ERROR) {
alert ('error);
} else if (status === Strophe.Status.CONNECTING) {
alert ('connecting');
} else if (status === Strophe.Status.CONNFAIL) {
alert ('connfail');
} else if (status === Strophe.Status.AUTHENTICATING) {
alert ('authenticating');
} else if (status === Strophe.Status.AUTHFAIL) {
alert('authfail');
} else if (status === Strophe.Status.ATTACHED) {
alert ('attached');
} else {
alert("error" + status);
}

});

...if i use this code, where do i have to put the code for the registration, so that registration only happens if needed and otherwise a normal login happens? I'm not a javascript expert so it would be nice if you perhaps could show me the code for this problem. I would be very thankful... Please tell me if you need more information...

greetz





Similar Threads
Thread Thread Starter Forum Replies Last Post
BOSH, Strophe, and Openfire iowadeifan BOOK: Professional XMPP Programming with JavaScript and jQuery 11 March 31st, 2014 03:08 PM
Joomla Strophe problem VladoAng BOOK: Professional XMPP Programming with JavaScript and jQuery 2 April 26th, 2012 04:55 AM
Strophe hangs after attaching nielsvh BOOK: Professional XMPP Programming with JavaScript and jQuery 1 February 5th, 2012 07:37 PM
Strophe Connection Error jpeterson7755 BOOK: Professional XMPP Programming with JavaScript and jQuery 1 February 28th, 2011 01:48 AM
Using sha1 passwords in Strophe.js semper BOOK: Professional XMPP Programming with JavaScript and jQuery 1 June 28th, 2010 02:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.