I had the same problem in my code (I'm using my version of Candy Chat), and the problem was I wasn't calling the BOSH _proto
version of _doDisconnect
in time.
_doDisconnect: function ()
{
this.sid = null;
this.rid = Math.floor(Math.random() * 4294967295);
window.sessionStorage.removeItem('strophe-bosh-session');
},
You must make sure this is called before your code calls the Strophe _changeConnectStatus
function for a disconnect. Or at least set the current connection this.sid = null
.
In other words, you have to make sure Strophe nulls the current "sid" value so the next ping sends no "sid" or a new one (I think none, but might be a new one). If not, your client side next "send" ping has the old value in it even though the server now disconnecting. Then the server gives the not very informative 404 error, which is actually letting you know that that connection is no longer valid (which of course is what I wanted in the first place). Sort of a which came first, the chicken or the egg problem.
Hope that helps a little with one version of why that error comes up. The standard version of Candy Chat resets everything before every connection attempt, so it doesn't have this problem.