Strophe submits a double page load request

I wrote an XMPP client with jQuery + Strophe. Everything works well (1-on-1, availability, MUC, etc.) and is contained in the jQuery plugin. However, when the page is unloaded, it sends 2 final requests with the same deletion. This only recently became a problem when I started working with session attaching.

Here is an example of a Firebug console:

enter image description here

Here I just logged in and immediately updated the page. The first message you see is the initial stanza of presence after logging in. After this request, a new BOSH request began to keep the connection open for the server. This request is interrupted when I refresh the page. So far, everything is going as I expected.

However, after an aborted request, strophe sends another request with the same RID. The final request is sent from the stanza for (I suppose) good manners and is not related to the problem. However, his answer indicates that openfire (XMPP server) killed the session in an attempt to protect the account.

I looked through my code and cannot find the request made on my behalf. I am pretty sure the stanza is sending this request. However, this should come from what I did since my initial prototype did not have this problem (in fact, I often had to manually kill sessions in the admin panel because I forgot to close them through the client).

Are there any known issues that I should check before posting a violation code?

+4
source share
1 answer

I returned to the working prototype, but found that he also had the same error. After a little testing, I found out that this only happens after I immediately refresh the page. If the request was made before the page was refreshed, an error does not occur. I informed the developer about it and made to crack his work until he was fixed on their side.

UPDATE:

I found out that this only happens with Firefox. Safari and even IE do it right (i.e. Do not double post). So maybe Firefox, which is still misbehaving!

UPDATE 2:

I received a letter requesting changes. Here they are.

In strophe.js, line 2566 change

sendFunc(); 

to

 if (req.sends == 0) { sendFunc(); } 
+2
source

All Articles