Auto-reconnect on refresh
@orangecoloured I'm trying to modify the code to have it auto-reconnect to the server on browser refresh. I have modified index.js as shown in the image to remove the popup dialog. However, I am getting http://xx.xx.xx.xx/http-bind 404 (Invalid SID.) error. Any pointers?

The problem is it's not an actual reconnect. It's an attachment to the existing connection.
It checks your JID, SID and RID. If i got everything right the SID is critical here. It has a small possible gap, like 1-5 for example. If you had a SID of 1 during the last request the server increases it by one and next time client must provide server with correct SID, in this case - 3.
I store the SID every request. And maybe on page refresh it can get not exactly the last value. So the next attachment it's going to send the old incorrect SID and get rejected. I tried increasing the SID on attach event, but no success. That's why I put the popup there and didn't make it the default behaviour.
I'll look into it later.
Thank you for the quick response. I'll play around with the SID to see if I can get it to work.
@jmm312 have you been able to resolve it? @orangecoloured is it possible to avoid the need to reconnect by keeping the connection open while the app is in the background? I found that after some time the user gets disconnected from jabber
@lgalant Do you mean in the background on the mobile? I'm afraid Cordova apps can't run in the background and the disconnect happens because the app shuts down. That's why the attach method is the only good way to quickly reconnect on launching the app.
@orangecoloured yes, I tweaked jabber to send messages as push notifications to the phone when the user is offline. When I click the notification it wakes the app up, but the user is offline. Do you have any pointers on how to fix the BOSH attach? I was thinking to store the password and do an actual reconnect, do you think that would work?
Thanks in advance for your help and awesome work on this app!
@lgalant Well, the attach probably needs some debugging. It's in the XMPP docs, so I assume it should work. =)
But the logging in again is definitely going to work. I'm not sure if it's the best practice to store the password somewhere on the frontend side. But I don't see any other way to quickly log in after a disconnect not using the BOSH attach.