Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto_reconnect does not work as expected #333

Closed
gpadbidri opened this issue Mar 11, 2015 · 11 comments
Closed

auto_reconnect does not work as expected #333

gpadbidri opened this issue Mar 11, 2015 · 11 comments
Labels

Comments

@gpadbidri
Copy link

Hi JC,

I have the auto_reconnect : true in my converse.initialize However, it fails when reconnect actually happens...

Following is the Test Case :

  1. Login to the Web Client.
    2.Stay idle for some time...We see the this.onConnect => converse.reconnect(); gets invoked.
  2. Reconnect happens but XMPP Server shows the user as offline. Also, other users trying to ping this user see him offline. This means the presence is NOT sent.

Where in the converse code is the right place to send the presence ? Ideally, reconnecting should also keep the User State as Online, right ?

NOTE : I have not modified any code that can impact this behavior.

@gpadbidri gpadbidri changed the title ConverseJS : auto_reconnect does notwork as expected ConverseJS : auto_reconnect does not work as expected Mar 11, 2015
@jcbrand jcbrand changed the title ConverseJS : auto_reconnect does not work as expected auto_reconnect does not work as expected Mar 12, 2015
@jcbrand jcbrand added the bug label Mar 12, 2015
@jcbrand
Copy link
Member

jcbrand commented Mar 12, 2015

Related: #330

@jcbrand
Copy link
Member

jcbrand commented Mar 12, 2015

I don't know if it's so simple as that a presence is not sent, I think the problem is more that the strophe connection is not properly torn down. I'm not sure what the solution is, I'd have to investigate more deeply to get an idea of what the issue is.

jcbrand added a commit that referenced this issue Mar 21, 2015
@jcbrand
Copy link
Member

jcbrand commented Mar 21, 2015

@gpadbidri Can you please see whether reconnecting now works for you? You'll need to specify prebind and prebind_url.

@jcbrand
Copy link
Member

jcbrand commented Apr 8, 2015

I'm assuming it's fixed now.

@jcbrand jcbrand closed this as completed Apr 8, 2015
@gauripadbidri
Copy link

@jcbrand : I have exposed a prebind_url which returns me the JID, SID and RID (Incrememnted by 1)in response...I have also set auto_reconnect:true in my converse.initializ call...But, seems like the connection is established, but the Contacts Panel does NOT get refreshed, meaning :

  1. Assume User1 has logged in and sees User2 and User 3 logged in (Online Icon)
  2. I restart the XMPP Server, now this.onConnect gets called and the ELSE PART gets invoked :
if ((typeof reconnect !== 'undefined') && (reconnect)) { converse.log(status === Strophe.Status.CONNECTED ? 'Reconnected' : 'Reattached'); converse.onReconnected(); } else { converse.log(status === Strophe.Status.CONNECTED ? 'Connected' : 'Attached'); converse.onConnected(); }

NOTE : Ideally, the IF Part should have gotten called as it is reconnect after Step #2
3. I see a new connection established...However, Contacts Panel still shows User 2 and User 3 as ONLINE, when they are offline.
4. Looking at 3, means the roster is NOT initialized.
5. Refreshing the Page displays User 2 and User 3 as OFFLINE - Expected (as restarting XMPP disconnected User 2 and User 3...Hence they seem offline)

Can you help me figure out what could have gone wrong ? Thanks !

@jcbrand
Copy link
Member

jcbrand commented Jun 15, 2015

Please try to figure out why the first part of the if statement didn't execute. What is the value of reconnect? That appears to be a bug.

@gauripadbidri
Copy link

It is ‘undefined’…this.onConnect is invoked from StartNewBOSHSession where we are NOT setting any value for reconnect parameter. Also, even if I do some code hack (likesetting a GLOBAL Flag demoFlag = true;) in the onSucess of startNewBoshSession and check it within the onConnect as follows :

if (demoFlag === true || ((typeof reconnect !== 'undefined') && (reconnect))) {

                converse.log(status === Strophe.Status.CONNECTED ? 'Reconnected' : 'Reattached');

                jQuery(".controlbox-panes").css('position','absolute');

                jQuery(".controlbox-panes").css('bottom','0px');

                converse.onReconnected();

            } else {

                converse.log(status === Strophe.Status.CONNECTED ? 'Connected' : 'Attached');

                converse.onConnected();



            }

In the above case,the IF part is executed meaning reconnect happens, but still the issue remains.

From: JC Brand [mailto:notifications@github.com]
Sent: Monday, June 15, 2015 9:02 PM
To: jcbrand/converse.js
Cc: gauripadbidri
Subject: Re: [converse.js] auto_reconnect does not work as expected (#333)

Please try to figure out why the first part of the if statement didn't execute. What is the value of reconnect? That appears to be a bug.


Reply to this email directly or view it on GitHub #333 (comment) .Image removed by sender.

@gauripadbidri
Copy link

@jcbrand : Any updates on this issue ?

@gauripadbidri
Copy link

@jcbrand : Also, setting "auto_reconnect" to true, should ideally keep polling the XMPP Server until the XMPP Server is UP ? I am not sure if the current code does that ? It just fires the reconnect event once and if the PREBIND URL was unable to send the JID SID and RID in response, it will delete the connection....

@jcbrand jcbrand reopened this Jun 17, 2015
@jcbrand
Copy link
Member

jcbrand commented Jun 17, 2015

Yes, it's clear the reconnection can still be improved.

@jcbrand jcbrand closed this as completed Jun 17, 2015
@jcbrand
Copy link
Member

jcbrand commented Jun 17, 2015

Please create 2 new tickets.

One for the status of contacts not being shown properly after reconnecting (you say they were wrongly shown as "online") and one for polling the server when reconnecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants