librelist archives

« back to archive

connected flag still true after disconnect

connected flag still true after disconnect

From:
Justin Stefani
Date:
2014-10-08 @ 19:12
Hi,

When I execute the Strophe disconnect function, I notice that when my
connect_callback handler is called, it will first go through the
DISCONNECTING state, then reaches the DISCONNECTED state. If I put a
breakpoint at the DISCONNECTED state, and I check the state of my converse
connection, I notice that the connected flag is still set to true. Why is
that? The session on the xmpp server has obviously disconnected by that
point.

thanks

Re: [conversejs] connected flag still true after disconnect

From:
Jc Brand
Date:
2014-10-09 @ 13:32
On Wed, Oct 08, 2014 at 03:12:07PM -0400, Justin Stefani wrote:
>    Hi,
>    When I execute the Strophe disconnect function, I notice that when my
>    connect_callback handler is called, it will first go through the
>    DISCONNECTING state, then reaches the DISCONNECTED state. If I put a
>    breakpoint at the DISCONNECTED state, and I check the state of my converse
>    connection, I notice that the connected flag is still set to true. Why is
>    that? The session on the xmpp server has obviously disconnected by that
>    point.
>    thanks

The "connected" property is set to "false" in strophe.js, not in converse.js
and it happens right after the handlers for the DISCONNECTED state are called.

See here:

https://github.com/strophe/strophejs/blob/b3233db549e3e0a51f144154ff7c34f0bcb0c022/src/core.js#L2259

Why it's done after calling the handlers, I don't know. Perhaps there's a good
reason for it. It's been like this for at least 5 years.

You can perhaps file a ticket for it on the strophe.js Github repo.