sstrigler / JSJaC

JavaScript Jabber Client Library
Other
295 stars 86 forks source link

ondisconnect not being triggered #73

Open SET001 opened 10 years ago

SET001 commented 10 years ago

There are some cases when ondisconnect event is not being triggered. If we have some logged in user and then another user will log in using same credentials, then on first user side 2 event will be triggered: onStatusChanged with session-terminate-conflict and onerror with error code of 503. But even if in both cases I would call JSJaCWebSocketConnection.disconnect() - it still would to trigger ondisconnect event so there are no one point where I can definitely say that it was disconnected.

SET001 commented 10 years ago

At the time onStatusChanged triggered xmpp.connected() return true but later, in onerror, it is already disconnected. So I suppose ondisconnect should be triggered between them. For the moment I fixed it with calling xmpp.disconnect() manually in onStatusChanged but still suppose such a behavior is a bug.