I’ve seen this a few times, haven’t figured out what it means but doesn’t seem great (an error in console). I am unsure if it affects anything
Ok so it seems like this happens because this code:
xmpp.start().catchError(function (err) {
trace(err);
if (this.state.can(“connection-error”)) this.state.event(“connection-error”, { error: err });
}
assumes we are in an unrecoverable state, but xmppjs does retry still and we can end up being connected.
still not 100% sure what the solution is. We want this behaviour on initial login, but maybe not on resume?
I’m working on reproducing more reliably so I can test potential fixes.
OK, think I’ve figured out what actually causes this.
xmpp.start() can fail with a TimeoutError after 2 seconds trying to open the stream. But this doesn’t cancel the connection attempt, so just because it fails with this doesn’t mean the stream won’t still open. What happens is that if the stream opening is slow it throws the error, we transition to offline, and then xmpp.on(‘online’) triggers and we try to connection-success.
I have a fix that seems to work locally (call xmpp.disconnect() on a timeouterror) but still verifying that this is the correct thing to do and trying to understand if there are any other ramifications there.
I didn’t log with the original ticket, but I do remember that I did see a timeout error in console when this happened to me in real life, and is consistent with the fact that sometimes requests to my server are shockingly slow. I reproduced these conditions by editing code in xmppjs to add a 3 second delay.
Alternately we ignore TimeoutError in this context and let it continue to connect? But not sure if it will eventually fail for real that way…
875abe97d19c0ec5400dadbb8a01eb856af71b2f