librelist archives

« back to archive

Re: [converse.js] noone online after reload w/ prebind (#169)

Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Anton Popov
Date:
2014-05-30 @ 08:40
> here’s the console log after a reload w/ 0.7.4:
> 
> Attached converse.min.js:163
> 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> 0 request id 1.0 posting converse.min.js:163
> 0 request id 1.0 state changed to 1 converse.min.js:163
> <body rid=​"1782556600" 
xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" 
sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> <iq to=​"conference.jabber.domain.com" 
from=​"user@jabber.domain.com/​39459055681401436200110264" type=​"get" 
xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> <query xmlns=​"http:​/​/​jabber.org/​protocol/​disco#items">​</query>​
> </iq>​
> <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> <query xmlns=​"jabber:​iq:​roster">​</query>​
> </iq>​
> </body>​
>  converse.min.js:163
> 0 request id 1.1 state changed to 2 converse.min.js:163
> 13
> 0 request id 1.1 state changed to 3 converse.min.js:163
> 0 request id 1.1 state changed to 4 converse.min.js:163
> 0 removing request converse.min.js:163
> 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> 0 request id 1 should now be removed converse.min.js:163
> 0 request id 1.1 got 200 converse.min.js:163
> <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​
> <iq xmlns=​"jabber:​client" from=​"user@jabber.domain.com" 
to=​"user@jabber.domain.com/​39459055681401436200110264" 
id=​"6590:​roster" type=​"result">​
> <query xmlns=​"jabber:​iq:​roster">​​
> <item subscription=​"both" name=​"First Last" 
jid=​"flast@jabber.domain.com">​…​</item>​
> 
> </query>​
> </iq>​
> </body>​
>  converse.min.js:163
> 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> 0 request id 2.0 posting converse.min.js:163
> 0 request id 2.0 state changed to 1 converse.min.js:163
> <body rid=​"1782556601" 
xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" 
sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> <presence xmlns=​"jabber:​client">​</presence>​
> </body>​
>  converse.min.js:163
> 0 request id 2.1 state changed to 2 converse.min.js:163
> 0 request id 2.1 state changed to 3 converse.min.js:163
> 0 request id 2.1 state changed to 4 converse.min.js:163
> 0 removing request converse.min.js:163
> 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> 0 request id 2 should now be removed converse.min.js:163
> 0 request id 2.1 got 200 converse.min.js:163
> <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​
> <presence xmlns=​"jabber:​client" 
from=​"user@jabber.domain.com/​39459055681401436200110264" 
to=​"user@jabber.domain.com/​39459055681401436200110264">​</presence>​
> </body>​
>  converse.min.js:163
> 1 no requests during idle cycle, sending blank request converse.min.js:163
> 0 request id 3.0 posting converse.min.js:163
> 0 request id 3.0 state changed to 1 converse.min.js:163
> <body rid=​"1782556602" 
xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" 
sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​</body>​
>  converse.min.js:163
> 0 request id 3.1 state changed to 2 converse.min.js:163
> 0 request id 3.1 state changed to 3 converse.min.js:163
> 0 request id 3.1 state changed to 4 converse.min.js:163
> 0 removing request converse.min.js:163
> 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> 0 request id 3 should now be removed converse.min.js:163
> 0 request id 3.1 got 200 converse.min.js:163
> <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​</body>​
>  converse.min.js:163
> 1 no requests during idle cycle, sending blank request converse.min.js:163
> 0 request id 4.0 posting converse.min.js:163
> 0 request id 4.0 state changed to 1 converse.min.js:163
> <body rid=​"1782556603" 
xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" 
sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​</body>​
>  converse.min.js:163
> 

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-05-30 @ 12:54
On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> 
> > here’s the console log after a reload w/ 0.7.4:
> > 
> > Attached converse.min.js:163
> > 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> > 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> > 0 request id 1.0 posting converse.min.js:163
> > 0 request id 1.0 state changed to 1 converse.min.js:163
> > <body rid=​"1782556600" 
xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" 
sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > <iq to=​"conference.jabber.domain.com" 
from=​"user@jabber.domain.com/​39459055681401436200110264" type=​"get" 
xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> > <query xmlns=​"http:​/​/​jabber.org/​protocol/​disco#items">​</query>​
> > </iq>​
> > <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> > <query xmlns=​"jabber:​iq:​roster">​</query>​
> > </iq>​
> > </body>​
> >  converse.min.js:163
> > 0 request id 1.1 state changed to 2 converse.min.js:163
> > 13
> > 0 request id 1.1 state changed to 3 converse.min.js:163
> > 0 request id 1.1 state changed to 4 converse.min.js:163
> > 0 removing request converse.min.js:163
> > 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> > 0 request id 1 should now be removed converse.min.js:163
> > 0 request id 1.1 got 200 converse.min.js:163
> > <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​
> > <iq xmlns=​"jabber:​client" from=​"user@jabber.domain.com" 
to=​"user@jabber.domain.com/​39459055681401436200110264" 
id=​"6590:​roster" type=​"result">​
> > <query xmlns=​"jabber:​iq:​roster">​​
> > <item subscription=​"both" name=​"First Last" 
jid=​"flast@jabber.domain.com">​…​</item>​
> > 
> > </query>​
> > </iq>​
> > </body>​
> >  converse.min.js:163
> > 0 _throttledRequestHandler called with 0 requests converse.min.js:163
> > 0 request id 2.0 posting converse.min.js:163
> > 0 request id 2.0 state changed to 1 converse.min.js:163
> > <body rid=​"1782556601" 
xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" 
sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > <presence xmlns=​"jabber:​client">​</presence>​
> > </body>​

Above you send out a presence broadcast after getting your contacts roster.

The XMPP server should forward this presence to all your contacts, and they
should then return their own presences.

> > <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​
> > <presence xmlns=​"jabber:​client" 
from=​"user@jabber.domain.com/​39459055681401436200110264" 
to=​"user@jabber.domain.com/​39459055681401436200110264">​</presence>​
> > </body>​

Above you get your own previously sent presence sent back to you by the XMPP
server.

And in the rest of the debug output you posted I don't see a presence 
returned from your
roster contact.

So that implies that the other user is not online.

What XMPP client is the other user using? Is the other user logged in with
converse.js in a different browser?

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Anton Popov
Date:
2014-05-30 @ 13:07
could not decode message

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-05-30 @ 15:58
On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
>    Hi
>    I removed a lot of lines from the log as i thought they were redundant.

The bits that are important are the XML stanzas.

>    In here where the empty line is are i think all users in the roster, not
>    just online.

The IQ stanza returned from the XMPP server has all your roster contacts yes.

>    The jabber server has at all times at least 20 users online, often more.
>    All use ichat/pidgin as i am testing converse.js and only i,
>    [1]user@jabber.domain.com in this log use converse.

When you reload the page with converse.js, does your user appear as an 
online contact
in ichat/pidgin or not?

>    Do you want the log from the initial page load, before the page reload?
> 
>        <query xmlns=​"jabber:​iq:​roster">​​
> 
>        <item subscription=​"both" name=​"First Last"
>        jid=​"[2]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​

No, what happens before the page is reloaded is not relevant AFAIK.

To be honest, I don't know what the problem is here. From what I can tell from
the log you posted, Converse.js *does* broadcast your presence when you reload
the page, but doesn't get any presences back from other users.

If converse.js doesn't get any presences back, there's not much it can do or be
responsible for.

The last times there was an issue similar to this, it was either that

1. converse didn't broadcast the user's presence upon page reload, or
2. converse wasn't ready to receive other users' presences once they started
appearing.

Neither of these 2 issues appear to be the case here.

Are you sure it's not a problem with prebinding? Are you 100% sure that you are
logged in when you reload the page?

All I can suggest is that you continue debugging. For example, checking your
server logs to see what they say when you reload converse.

Pidgin has a nice plugin that shows the XML that it sends and receives. I would
install that as well and see what comes up.

I'm skeptical that this is a bug with converse.js because I would expect
many more people to report this. But so far you're the only one (bar a few
people who struggled with prebind issues).

Good luck
JC

>    On 30 May 2014, at 14:54, "JC Brand" <[3]lists@opkode.com> wrote:
> 
>      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> 
>          here’s the console log after a reload w/ 0.7.4:
> 
>          Attached converse.min.js:163< br>
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1.0 posting converse.min.js:163
> 
>          0 request id 1.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556600"
>          xmlns=​"http:​/​/​[4]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <iq to=​"[5]conference.jabber.domain.com"
>          from=​"[6]user@jabber.domain.com/​39459055681401436200110264"
>          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> 
>          <query
>          xmlns=​"http:​/​/​[7]jabber.org/​protocol/​disco#items">​</query>​
> 
>          </iq>​
> 
>          <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> 
>          <query xmlns=​"jabber:​iq:​roster">​</query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 request id 1.1 state changed to 2 converse.min.js:163
> 
>          13
> 
>          0 request id 1.1 state changed to 3 converse.min.js:163
> 
>          0 request id 1.1 state changed to 4 converse.min.js:163
> 
>          0 removing request converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1 should now be removed converse.min.js:163
> 
>          0 request id 1.1 got 200 converse.min.js:163
> 
>          <body xmlns=​"http:​/​/​[8]jabber.org/​protocol/​httpbind">​
> 
>          <iq xmlns=​"jabber:​client" from=​"[9]user@jabber.domain.com"
>          to=​"[10]user@jabber.domain.com/​39459055681401436200110264"
>          id=​"6590:​roster" type=​"result">​
> 
>          <query xmlns=​"jabber:​iq:​ros ter">​​
> 
>          <item subscription=​"both" name=​"First Last"
>          jid=​"[11]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 2.0 posting converse.min.js:163
> 
>          0 request id 2.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556601"
>          xmlns=​"http:​/​/​[12]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <presence xmlns=​"jabber:​client">​</presence>​
> 
>          </body>​
> 
>      Above you send out a presence broadcast after getting your contacts
>      roster.
>      The XMPP server should forward this presence to all your contac ts, and
>      they
>      should then return their own presences.
> 
>          <body xmlns=​"http:​/​/​[13]jabber.org/​protocol/​httpbind">​
> 
>          <presence xmlns=​"jabber:​client"
>          from=​"[14]user@jabber.domain.com/​39459055681401436200110264"
>          
to=​"[15]user@jabber.domain.com/​39459055681401436200110264">​</presence>​
> 
>          </body>​
> 
>      Above you get your own previously sent presence sent back to you by the
>      XMPP
>      server.
>      And in the rest of the debug output you posted I don't see a presen ce
>      returned from your
>      roster contact.
>      So that implies that the other user is not online.
>      What XMPP client is the other user using? Is the other user logged in
>      with converse.js in a different browser?
> 
> References
> 
>    Visible links
>    1. mailto:user@jabber.domain.com
>    2. mailto:flast@jabber.domain.com
>    3. mailto:lists@opkode.com
>    4. http://jabber.org/
>    5. http://conference.ja bber.domain.com/
>    6. mailto:user@jabber.domain.com
>    7. http://jabber.org/
>    8. http://jabber.org/
>    9. mailto:user@jabber.domain.com
>   10. mailto:user@jabber.domain.com
>   11. mailto:flast@jabber.domain.com
>   12. http://jabber.org/
>   13. http://jabber.org/
>   14. mailto:user@jabber.domain.com
>   15. mailto:user@jabber.domain.com

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Anton Popov
Date:
2014-06-02 @ 07:14
Hi,

Yes, I am online to other users after I reload so the prebind works (they 
can send me messages and I can reply, though they appear offline)
If I just wait there users that login jabber after the reload start 
showing up (new arrivals, not the currently online users).
Users that only change their status do not show up. 

He's what pidgin's XMPP console says when I reload:


<presence from='userconversejs@domain.com/33359431491401692036823617' 
to='userpidgin@domain.com/HQ'/>


And that's all.

Can I "re-login" every time I reload the page so I get the current availability?
I'll enable debugging on the ejabberd server and see if anything useful 
gets logged there.

Thanks,
Anton.



-----Original Message-----
From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf
Of JC Brand
Sent: Friday, May 30, 2014 17:58
To: conversejs@librelist.com
Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/ 
prebind (#169)

On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
>    Hi
>    I removed a lot of lines from the log as i thought they were redundant.

The bits that are important are the XML stanzas.

>    In here where the empty line is are i think all users in the roster, not
>    just online.

The IQ stanza returned from the XMPP server has all your roster contacts yes.

>    The jabber server has at all times at least 20 users online, often more.
>    All use ichat/pidgin as i am testing converse.js and only i,
>    [1]user@jabber.domain.com in this log use converse.

When you reload the page with converse.js, does your user appear as an 
online contact in ichat/pidgin or not?

>    Do you want the log from the initial page load, before the page reload?
> 
>        <query xmlns=​"jabber:​iq:​roster">​​
> 
>        <item subscription=​"both" name=​"First Last"
>        jid=​"[2]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​

No, what happens before the page is reloaded is not relevant AFAIK.

To be honest, I don't know what the problem is here. From what I can tell 
from the log you posted, Converse.js *does* broadcast your presence when 
you reload the page, but doesn't get any presences back from other users.

If converse.js doesn't get any presences back, there's not much it can do 
or be responsible for.

The last times there was an issue similar to this, it was either that

1. converse didn't broadcast the user's presence upon page reload, or 2. 
converse wasn't ready to receive other users' presences once they started 
appearing.

Neither of these 2 issues appear to be the case here.

Are you sure it's not a problem with prebinding? Are you 100% sure that 
you are logged in when you reload the page?

All I can suggest is that you continue debugging. For example, checking 
your server logs to see what they say when you reload converse.

Pidgin has a nice plugin that shows the XML that it sends and receives. I 
would install that as well and see what comes up.

I'm skeptical that this is a bug with converse.js because I would expect 
many more people to report this. But so far you're the only one (bar a few
people who struggled with prebind issues).

Good luck
JC

>    On 30 May 2014, at 14:54, "JC Brand" <[3]lists@opkode.com> wrote:
> 
>      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> 
>          here’s the console log after a reload w/ 0.7.4:
> 
>          Attached converse.min.js:163< br>
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1.0 posting converse.min.js:163
> 
>          0 request id 1.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556600"
>          xmlns=​"http:​/​/​[4]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <iq to=​"[5]conference.jabber.domain.com"
>          from=​"[6]user@jabber.domain.com/​39459055681401436200110264"
>          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> 
>          <query
>          
> xmlns=​"http:​/​/​[7]jabber.org/​protocol/​disco#items">​</query>​
> 
>          </iq>​
> 
>          <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> 
>          <query xmlns=​"jabber:​iq:​roster">​</query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 request id 1.1 state changed to 2 converse.min.js:163
> 
>          13
> 
>          0 request id 1.1 state changed to 3 converse.min.js:163
> 
>          0 request id 1.1 state changed to 4 converse.min.js:163
> 
>          0 removing request converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1 should now be removed converse.min.js:163
> 
>          0 request id 1.1 got 200 converse.min.js:163
> 
>          <body xmlns=​"http:​/​/​[8]jabber.org/​protocol/​httpbind">​
> 
>          <iq xmlns=​"jabber:​client" from=​"[9]user@jabber.domain.com"
>          to=​"[10]user@jabber.domain.com/​39459055681401436200110264"
>          id=​"6590:​roster" type=​"result">​
> 
>          <query xmlns=​"jabber:​iq:​ros ter">​​
> 
>          <item subscription=​"both" name=​"First Last"
>          jid=​"[11]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 2.0 posting converse.min.js:163
> 
>          0 request id 2.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556601"
>          xmlns=​"http:​/​/​[12]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <presence xmlns=​"jabber:​client">​</presence>​
> 
>          </body>​
> 
>      Above you send out a presence broadcast after getting your contacts
>      roster.
>      The XMPP server should forward this presence to all your contac ts, and
>      they
>      should then return their own presences.
> 
>          <body xmlns=​"http:​/​/​[13]jabber.org/​protocol/​httpbind">​
> 
>          <presence xmlns=​"jabber:​client"
>          from=​"[14]user@jabber.domain.com/​39459055681401436200110264"
>          
> to=​"[15]user@jabber.domain.com/​39459055681401436200110264">​</presen
> ce>​
> 
>          </body>​
> 
>      Above you get your own previously sent presence sent back to you by the
>      XMPP
>      server.
>      And in the rest of the debug output you posted I don't see a presen ce
>      returned from your
>      roster contact.
>      So that implies that the other user is not online.
>      What XMPP client is the other user using? Is the other user logged in
>      with converse.js in a different browser?
> 
> References
> 
>    Visible links
>    1. mailto:user@jabber.domain.com
>    2. mailto:flast@jabber.domain.com
>    3. mailto:lists@opkode.com
>    4. http://jabber.org/
>    5. http://conference.ja bber.domain.com/
>    6. mailto:user@jabber.domain.com
>    7. http://jabber.org/
>    8. http://jabber.org/
>    9. mailto:user@jabber.domain.com
>   10. mailto:user@jabber.domain.com
>   11. mailto:flast@jabber.domain.com
>   12. http://jabber.org/
>   13. http://jabber.org/
>   14. mailto:user@jabber.domain.com
>   15. mailto:user@jabber.domain.com

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-07-19 @ 22:15
While working on ticket #83, my memory was refreshed and I think I might 
have found the solution for
this issue.

If roster users are all shown as offline, then it means their chat_status
attribute wasn't being stored.

The solution is to call the "save" method instead of the "set" method, to
assure that the changed values are stored.

The change is here:

https://github.com/jcbrand/converse.js/commit/0aca9ef3c22d7814567ddc3107c83b810234365a


On Mon, Jun 02, 2014 at 07:14:22AM +0000, Anton Popov wrote:
> Hi,
> 
> Yes, I am online to other users after I reload so the prebind works 
(they can send me messages and I can reply, though they appear offline)
> If I just wait there users that login jabber after the reload start 
showing up (new arrivals, not the currently online users).
> Users that only change their status do not show up. 
> 
> He's what pidgin's XMPP console says when I reload:
> 
> 
> <presence from='userconversejs@domain.com/33359431491401692036823617' 
to='userpidgin@domain.com/HQ'/>
> 
> 
> And that's all.
> 
> Can I "re-login" every time I reload the page so I get the current availability?
> I'll enable debugging on the ejabberd server and see if anything useful 
gets logged there.
> 
> Thanks,
> Anton.
> 
> 
> 
> -----Original Message-----
> From: conversejs@librelist.com [mailto:conversejs@librelist.com] On 
Behalf Of JC Brand
> Sent: Friday, May 30, 2014 17:58
> To: conversejs@librelist.com
> Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/
prebind (#169)
> 
> On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
> >    Hi
> >    I removed a lot of lines from the log as i thought they were redundant.
> 
> The bits that are important are the XML stanzas.
> 
> >    In here where the empty line is are i think all users in the roster, not
> >    just online.
> 
> The IQ stanza returned from the XMPP server has all your roster contacts yes.
> 
> >    The jabber server has at all times at least 20 users online, often more.
> >    All use ichat/pidgin as i am testing converse.js and only i,
> >    [1]user@jabber.domain.com in this log use converse.
> 
> When you reload the page with converse.js, does your user appear as an 
online contact in ichat/pidgin or not?
> 
> >    Do you want the log from the initial page load, before the page reload?
> > 
> >        <query xmlns=​"jabber:​iq:​roster">​​
> > 
> >        <item subscription=​"both" name=​"First Last"
> >        jid=​"[2]flast@jabber.domain.com">​…​</item>​
> > 
> >          </query>​
> 
> No, what happens before the page is reloaded is not relevant AFAIK.
> 
> To be honest, I don't know what the problem is here. From what I can 
tell from the log you posted, Converse.js *does* broadcast your presence 
when you reload the page, but doesn't get any presences back from other 
users.
> 
> If converse.js doesn't get any presences back, there's not much it can 
do or be responsible for.
> 
> The last times there was an issue similar to this, it was either that
> 
> 1. converse didn't broadcast the user's presence upon page reload, or 2.
converse wasn't ready to receive other users' presences once they started 
appearing.
> 
> Neither of these 2 issues appear to be the case here.
> 
> Are you sure it's not a problem with prebinding? Are you 100% sure that 
you are logged in when you reload the page?
> 
> All I can suggest is that you continue debugging. For example, checking 
your server logs to see what they say when you reload converse.
> 
> Pidgin has a nice plugin that shows the XML that it sends and receives. 
I would install that as well and see what comes up.
> 
> I'm skeptical that this is a bug with converse.js because I would expect
many more people to report this. But so far you're the only one (bar a few
people who struggled with prebind issues).
> 
> Good luck
> JC
> 
> >    On 30 May 2014, at 14:54, "JC Brand" <[3]lists@opkode.com> wrote:
> > 
> >      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> > 
> >          here’s the console log after a reload w/ 0.7.4:
> > 
> >          Attached converse.min.js:163< br>
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 request id 1.0 posting converse.min.js:163
> > 
> >          0 request id 1.0 state changed to 1 converse.min.js:163
> > 
> >          <body rid=​"1782556600"
> >          xmlns=​"http:​/​/​[4]jabber.org/​protocol/​httpbind"
> >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > 
> >          <iq to=​"[5]conference.jabber.domain.com"
> >          from=​"[6]user@jabber.domain.com/​39459055681401436200110264"
> >          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> > 
> >          <query
> >          
> > xmlns=​"http:​/​/​[7]jabber.org/​protocol/​disco#items">​</query>​
> > 
> >          </iq>​
> > 
> >          <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> > 
> >          <query xmlns=​"jabber:​iq:​roster">​</query>​
> > 
> >          </iq>​
> > 
> >          </body>​
> > 
> >          converse.min.js:163
> > 
> >          0 request id 1.1 state changed to 2 converse.min.js:163
> > 
> >          13
> > 
> >          0 request id 1.1 state changed to 3 converse.min.js:163
> > 
> >          0 request id 1.1 state changed to 4 converse.min.js:163
> > 
> >          0 removing request converse.min.js:163
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 request id 1 should now be removed converse.min.js:163
> > 
> >          0 request id 1.1 got 200 converse.min.js:163
> > 
> >          <body xmlns=​"http:​/​/​[8]jabber.org/​protocol/​httpbind">​
> > 
> >          <iq xmlns=​"jabber:​client" from=​"[9]user@jabber.domain.com"
> >          to=​"[10]user@jabber.domain.com/​39459055681401436200110264"
> >          id=​"6590:​roster" type=​"result">​
> > 
> >          <query xmlns=​"jabber:​iq:​ros ter">​​
> > 
> >          <item subscription=​"both" name=​"First Last"
> >          jid=​"[11]flast@jabber.domain.com">​…​</item>​
> > 
> >          </query>​
> > 
> >          </iq>​
> > 
> >          </body>​
> > 
> >          converse.min.js:163
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 request id 2.0 posting converse.min.js:163
> > 
> >          0 request id 2.0 state changed to 1 converse.min.js:163
> > 
> >          <body rid=​"1782556601"
> >          xmlns=​"http:​/​/​[12]jabber.org/​protocol/​httpbind"
> >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > 
> >          <presence xmlns=​"jabber:​client">​</presence>​
> > 
> >          </body>​
> > 
> >      Above you send out a presence broadcast after getting your contacts
> >      roster.
> >      The XMPP server should forward this presence to all your contac ts, and
> >      they
> >      should then return their own presences.
> > 
> >          <body xmlns=​"http:​/​/​[13]jabber.org/​protocol/​httpbind">​
> > 
> >          <presence xmlns=​"jabber:​client"
> >          from=​"[14]user@jabber.domain.com/​39459055681401436200110264"
> >          
> > to=​"[15]user@jabber.domain.com/​39459055681401436200110264">​</presen
> > ce>​
> > 
> >          </body>​
> > 
> >      Above you get your own previously sent presence sent back to you by the
> >      XMPP
> >      server.
> >      And in the rest of the debug output you posted I don't see a presen ce
> >      returned from your
> >      roster contact.
> >      So that implies that the other user is not online.
> >      What XMPP client is the other user using? Is the other user logged in
> >      with converse.js in a different browser?
> > 
> > References
> > 
> >    Visible links
> >    1. mailto:user@jabber.domain.com
> >    2. mailto:flast@jabber.domain.com
> >    3. mailto:lists@opkode.com
> >    4. http://jabber.org/
> >    5. http://conference.ja bber.domain.com/
> >    6. mailto:user@jabber.domain.com
> >    7. http://jabber.org/
> >    8. http://jabber.org/
> >    9. mailto:user@jabber.domain.com
> >   10. mailto:user@jabber.domain.com
> >   11. mailto:flast@jabber.domain.com
> >   12. http://jabber.org/
> >   13. http://jabber.org/
> >   14. mailto:user@jabber.domain.com
> >   15. mailto:user@jabber.domain.com
> 
> 

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Anton Popov
Date:
2014-07-21 @ 17:06
Hi,
Thank you very much.
I am only able to get converse.js running with the minified converse.min.js 
and so far have not been able to install all the dependencies for converse.js 
to work so I am unable to test this now.
I will try to get this to work with converse.js when I have time and then test 
this solution.

-----Original Message-----
From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf Of 
JC Brand
Sent: Sunday, July 20, 2014 00:15
To: conversejs@librelist.com
Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/ 
prebind (#169)

While working on ticket #83, my memory was refreshed and I think I might have 
found the solution for this issue.

If roster users are all shown as offline, then it means their chat_status 
attribute wasn't being stored.

The solution is to call the "save" method instead of the "set" method, to 
assure that the changed values are stored.

The change is here:

https://github.com/jcbrand/converse.js/commit/0aca9ef3c22d7814567ddc3107c83b810234365a

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Andrei Charepka
Date:
2014-05-30 @ 17:04
I encountered the same issue with prebind -- my own presence would be set,
but all the contacts are offline. Their presence is eventually updated 
(10-15 minutes).

I found that sending an offline presence and then sending online causes 
the roster to be refreshed.

In my function that is called when converse is initialized, I do the 
following (if it's a pre-bind):

converse.connection.send($pres({type: "unavailable"}));
converse.connection.send($pres());

Here's a link to a discussion of a similar issue: 
https://groups.google.com/forum/#!topic/strophe/XWpvMx7MS_w

Andrei

-----Original Message-----
From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf
Of JC Brand
Sent: Friday, May 30, 2014 11:58 AM
To: conversejs@librelist.com
Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/ 
prebind (#169)

On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
>    Hi
>    I removed a lot of lines from the log as i thought they were redundant.

The bits that are important are the XML stanzas.

>    In here where the empty line is are i think all users in the roster, not
>    just online.

The IQ stanza returned from the XMPP server has all your roster contacts yes.

>    The jabber server has at all times at least 20 users online, often more.
>    All use ichat/pidgin as i am testing converse.js and only i,
>    [1]user@jabber.domain.com in this log use converse.

When you reload the page with converse.js, does your user appear as an 
online contact in ichat/pidgin or not?

>    Do you want the log from the initial page load, before the page reload?
> 
>        <query xmlns=​"jabber:​iq:​roster">​​
> 
>        <item subscription=​"both" name=​"First Last"
>        jid=​"[2]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​

No, what happens before the page is reloaded is not relevant AFAIK.

To be honest, I don't know what the problem is here. From what I can tell 
from the log you posted, Converse.js *does* broadcast your presence when 
you reload the page, but doesn't get any presences back from other users.

If converse.js doesn't get any presences back, there's not much it can do 
or be responsible for.

The last times there was an issue similar to this, it was either that

1. converse didn't broadcast the user's presence upon page reload, or 2. 
converse wasn't ready to receive other users' presences once they started 
appearing.

Neither of these 2 issues appear to be the case here.

Are you sure it's not a problem with prebinding? Are you 100% sure that 
you are logged in when you reload the page?

All I can suggest is that you continue debugging. For example, checking 
your server logs to see what they say when you reload converse.

Pidgin has a nice plugin that shows the XML that it sends and receives. I 
would install that as well and see what comes up.

I'm skeptical that this is a bug with converse.js because I would expect 
many more people to report this. But so far you're the only one (bar a few
people who struggled with prebind issues).

Good luck
JC

>    On 30 May 2014, at 14:54, "JC Brand" <[3]lists@opkode.com> wrote:
> 
>      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> 
>          here’s the console log after a reload w/ 0.7.4:
> 
>          Attached converse.min.js:163< br>
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1.0 posting converse.min.js:163
> 
>          0 request id 1.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556600"
>          xmlns=​"http:​/​/​[4]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <iq to=​"[5]conference.jabber.domain.com"
>          from=​"[6]user@jabber.domain.com/​39459055681401436200110264"
>          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> 
>          <query
>          
> xmlns=​"http:​/​/​[7]jabber.org/​protocol/​disco#items">​</query>​
> 
>          </iq>​
> 
>          <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> 
>          <query xmlns=​"jabber:​iq:​roster">​</query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 request id 1.1 state changed to 2 converse.min.js:163
> 
>          13
> 
>          0 request id 1.1 state changed to 3 converse.min.js:163
> 
>          0 request id 1.1 state changed to 4 converse.min.js:163
> 
>          0 removing request converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1 should now be removed converse.min.js:163
> 
>          0 request id 1.1 got 200 converse.min.js:163
> 
>          <body xmlns=​"http:​/​/​[8]jabber.org/​protocol/​httpbind">​
> 
>          <iq xmlns=​"jabber:​client" from=​"[9]user@jabber.domain.com"
>          to=​"[10]user@jabber.domain.com/​39459055681401436200110264"
>          id=​"6590:​roster" type=​"result">​
> 
>          <query xmlns=​"jabber:​iq:​ros ter">​​
> 
>          <item subscription=​"both" name=​"First Last"
>          jid=​"[11]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 2.0 posting converse.min.js:163
> 
>          0 request id 2.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556601"
>          xmlns=​"http:​/​/​[12]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <presence xmlns=​"jabber:​client">​</presence>​
> 
>          </body>​
> 
>      Above you send out a presence broadcast after getting your contacts
>      roster.
>      The XMPP server should forward this presence to all your contac ts, and
>      they
>      should then return their own presences.
> 
>          <body xmlns=​"http:​/​/​[13]jabber.org/​protocol/​httpbind">​
> 
>          <presence xmlns=​"jabber:​client"
>          from=​"[14]user@jabber.domain.com/​39459055681401436200110264"
>          
> to=​"[15]user@jabber.domain.com/​39459055681401436200110264">​</presen
> ce>​
> 
>          </body>​
> 
>      Above you get your own previously sent presence sent back to you by the
>      XMPP
>      server.
>      And in the rest of the debug output you posted I don't see a presen ce
>      returned from your
>      roster contact.
>      So that implies that the other user is not online.
>      What XMPP client is the other user using? Is the other user logged in
>      with converse.js in a different browser?
> 
> References
> 
>    Visible links
>    1. mailto:user@jabber.domain.com
>    2. mailto:flast@jabber.domain.com
>    3. mailto:lists@opkode.com
>    4. http://jabber.org/
>    5. http://conference.ja bber.domain.com/
>    6. mailto:user@jabber.domain.com
>    7. http://jabber.org/
>    8. http://jabber.org/
>    9. mailto:user@jabber.domain.com
>   10. mailto:user@jabber.domain.com
>   11. mailto:flast@jabber.domain.com
>   12. http://jabber.org/
>   13. http://jabber.org/
>   14. mailto:user@jabber.domain.com
>   15. mailto:user@jabber.domain.com

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Anton Popov
Date:
2014-06-02 @ 07:16
Hi, thanks for your mail.
What should $pres contain?
Sorry if stupid question, I am a sysadmin and javascript is not a native 
language for me.

-----Original Message-----
From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf
Of Andrei Charepka
Sent: Friday, May 30, 2014 19:04
To: conversejs@librelist.com
Subject: RE: [conversejs] Re: [converse.js] noone online after reload w/ 
prebind (#169)

I encountered the same issue with prebind -- my own presence would be set,
but all the contacts are offline. Their presence is eventually updated 
(10-15 minutes).

I found that sending an offline presence and then sending online causes 
the roster to be refreshed.

In my function that is called when converse is initialized, I do the 
following (if it's a pre-bind):

converse.connection.send($pres({type: "unavailable"})); 
converse.connection.send($pres());

Here's a link to a discussion of a similar issue: 
https://groups.google.com/forum/#!topic/strophe/XWpvMx7MS_w

Andrei

-----Original Message-----
From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf
Of JC Brand
Sent: Friday, May 30, 2014 11:58 AM
To: conversejs@librelist.com
Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/ 
prebind (#169)

On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
>    Hi
>    I removed a lot of lines from the log as i thought they were redundant.

The bits that are important are the XML stanzas.

>    In here where the empty line is are i think all users in the roster, not
>    just online.

The IQ stanza returned from the XMPP server has all your roster contacts yes.

>    The jabber server has at all times at least 20 users online, often more.
>    All use ichat/pidgin as i am testing converse.js and only i,
>    [1]user@jabber.domain.com in this log use converse.

When you reload the page with converse.js, does your user appear as an 
online contact in ichat/pidgin or not?

>    Do you want the log from the initial page load, before the page reload?
> 
>        <query xmlns=​"jabber:​iq:​roster">​​
> 
>        <item subscription=​"both" name=​"First Last"
>        jid=​"[2]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​

No, what happens before the page is reloaded is not relevant AFAIK.

To be honest, I don't know what the problem is here. From what I can tell 
from the log you posted, Converse.js *does* broadcast your presence when 
you reload the page, but doesn't get any presences back from other users.

If converse.js doesn't get any presences back, there's not much it can do 
or be responsible for.

The last times there was an issue similar to this, it was either that

1. converse didn't broadcast the user's presence upon page reload, or 2. 
converse wasn't ready to receive other users' presences once they started 
appearing.

Neither of these 2 issues appear to be the case here.

Are you sure it's not a problem with prebinding? Are you 100% sure that 
you are logged in when you reload the page?

All I can suggest is that you continue debugging. For example, checking 
your server logs to see what they say when you reload converse.

Pidgin has a nice plugin that shows the XML that it sends and receives. I 
would install that as well and see what comes up.

I'm skeptical that this is a bug with converse.js because I would expect 
many more people to report this. But so far you're the only one (bar a few
people who struggled with prebind issues).

Good luck
JC

>    On 30 May 2014, at 14:54, "JC Brand" <[3]lists@opkode.com> wrote:
> 
>      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> 
>          here’s the console log after a reload w/ 0.7.4:
> 
>          Attached converse.min.js:163< br>
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1.0 posting converse.min.js:163
> 
>          0 request id 1.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556600"
>          xmlns=​"http:​/​/​[4]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <iq to=​"[5]conference.jabber.domain.com"
>          from=​"[6]user@jabber.domain.com/​39459055681401436200110264"
>          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> 
>          <query
>          
> xmlns=​"http:​/​/​[7]jabber.org/​protocol/​disco#items">​</query>​
> 
>          </iq>​
> 
>          <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> 
>          <query xmlns=​"jabber:​iq:​roster">​</query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 request id 1.1 state changed to 2 converse.min.js:163
> 
>          13
> 
>          0 request id 1.1 state changed to 3 converse.min.js:163
> 
>          0 request id 1.1 state changed to 4 converse.min.js:163
> 
>          0 removing request converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 1 should now be removed converse.min.js:163
> 
>          0 request id 1.1 got 200 converse.min.js:163
> 
>          <body xmlns=​"http:​/​/​[8]jabber.org/​protocol/​httpbind">​
> 
>          <iq xmlns=​"jabber:​client" from=​"[9]user@jabber.domain.com"
>          to=​"[10]user@jabber.domain.com/​39459055681401436200110264"
>          id=​"6590:​roster" type=​"result">​
> 
>          <query xmlns=​"jabber:​iq:​ros ter">​​
> 
>          <item subscription=​"both" name=​"First Last"
>          jid=​"[11]flast@jabber.domain.com">​…​</item>​
> 
>          </query>​
> 
>          </iq>​
> 
>          </body>​
> 
>          converse.min.js:163
> 
>          0 _throttledRequestHandler called with 0 requests
>          converse.min.js:163
> 
>          0 request id 2.0 posting converse.min.js:163
> 
>          0 request id 2.0 state changed to 1 converse.min.js:163
> 
>          <body rid=​"1782556601"
>          xmlns=​"http:​/​/​[12]jabber.org/​protocol/​httpbind"
>          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> 
>          <presence xmlns=​"jabber:​client">​</presence>​
> 
>          </body>​
> 
>      Above you send out a presence broadcast after getting your contacts
>      roster.
>      The XMPP server should forward this presence to all your contac ts, and
>      they
>      should then return their own presences.
> 
>          <body xmlns=​"http:​/​/​[13]jabber.org/​protocol/​httpbind">​
> 
>          <presence xmlns=​"jabber:​client"
>          from=​"[14]user@jabber.domain.com/​39459055681401436200110264"
>          
> to=​"[15]user@jabber.domain.com/​39459055681401436200110264">​</presen
> ce>​
> 
>          </body>​
> 
>      Above you get your own previously sent presence sent back to you by the
>      XMPP
>      server.
>      And in the rest of the debug output you posted I don't see a presen ce
>      returned from your
>      roster contact.
>      So that implies that the other user is not online.
>      What XMPP client is the other user using? Is the other user logged in
>      with converse.js in a different browser?
> 
> References
> 
>    Visible links
>    1. mailto:user@jabber.domain.com
>    2. mailto:flast@jabber.domain.com
>    3. mailto:lists@opkode.com
>    4. http://jabber.org/
>    5. http://conference.ja bber.domain.com/
>    6. mailto:user@jabber.domain.com
>    7. http://jabber.org/
>    8. http://jabber.org/
>    9. mailto:user@jabber.domain.com
>   10. mailto:user@jabber.domain.com
>   11. mailto:flast@jabber.domain.com
>   12. http://jabber.org/
>   13. http://jabber.org/
>   14. mailto:user@jabber.domain.com
>   15. mailto:user@jabber.domain.com

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-06-02 @ 08:38
On Mon, Jun 02, 2014 at 07:16:29AM +0000, Anton Popov wrote:
> Hi, thanks for your mail.
> What should $pres contain?
> Sorry if stupid question, I am a sysadmin and javascript is not a native
language for me.

$pres is a Strophe.js function that builds a <presence> XML stanza.

What Andrei says makes perfect sense. From the perspective of your roster
contacts, you have already on the first page-load broadcasted your presence and
they then responded by broadcasting theirs.

When you reload the page and broadcast your presence again, your chat status is
the same, so they ignore it and don't respond by broadcasting their presences
again.

The solution appears to be to add a handler for the "onbeforeunload" event (fired
before the page refreshes) which sends a presence of type unavailable.

And then when the new page as loaded, a normal presence stanza is sent again.

This should fix the problem.

I've created a new ticket for this:
https://github.com/jcbrand/converse.js/issues/175

Thanks Andrei for the explanation!

 
> -----Original Message-----
> From: conversejs@librelist.com [mailto:conversejs@librelist.com] On 
Behalf Of Andrei Charepka
> Sent: Friday, May 30, 2014 19:04
> To: conversejs@librelist.com
> Subject: RE: [conversejs] Re: [converse.js] noone online after reload w/
prebind (#169)
> 
> I encountered the same issue with prebind -- my own presence would be 
set, but all the contacts are offline. Their presence is eventually 
updated (10-15 minutes).
> 
> I found that sending an offline presence and then sending online causes 
the roster to be refreshed.
> 
> In my function that is called when converse is initialized, I do the 
following (if it's a pre-bind):
> 
> converse.connection.send($pres({type: "unavailable"})); 
converse.connection.send($pres());
> 
> Here's a link to a discussion of a similar issue: 
https://groups.google.com/forum/#!topic/strophe/XWpvMx7MS_w
> 
> Andrei
> 
> -----Original Message-----
> From: conversejs@librelist.com [mailto:conversejs@librelist.com] On 
Behalf Of JC Brand
> Sent: Friday, May 30, 2014 11:58 AM
> To: conversejs@librelist.com
> Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/
prebind (#169)
> 
> On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
> >    Hi
> >    I removed a lot of lines from the log as i thought they were redundant.
> 
> The bits that are important are the XML stanzas.
> 
> >    In here where the empty line is are i think all users in the roster, not
> >    just online.
> 
> The IQ stanza returned from the XMPP server has all your roster contacts yes.
> 
> >    The jabber server has at all times at least 20 users online, often more.
> >    All use ichat/pidgin as i am testing converse.js and only i,
> >    [1]user@jabber.domain.com in this log use converse.
> 
> When you reload the page with converse.js, does your user appear as an 
online contact in ichat/pidgin or not?
> 
> >    Do you want the log from the initial page load, before the page reload?
> > 
> >        <query xmlns=​"jabber:​iq:​roster">​​
> > 
> >        <item subscription=​"both" name=​"First Last"
> >        jid=​"[2]flast@jabber.domain.com">​…​</item>​
> > 
> >          </query>​
> 
> No, what happens before the page is reloaded is not relevant AFAIK.
> 
> To be honest, I don't know what the problem is here. From what I can 
tell from the log you posted, Converse.js *does* broadcast your presence 
when you reload the page, but doesn't get any presences back from other 
users.
> 
> If converse.js doesn't get any presences back, there's not much it can 
do or be responsible for.
> 
> The last times there was an issue similar to this, it was either that
> 
> 1. converse didn't broadcast the user's presence upon page reload, or 2.
converse wasn't ready to receive other users' presences once they started 
appearing.
> 
> Neither of these 2 issues appear to be the case here.
> 
> Are you sure it's not a problem with prebinding? Are you 100% sure that 
you are logged in when you reload the page?
> 
> All I can suggest is that you continue debugging. For example, checking 
your server logs to see what they say when you reload converse.
> 
> Pidgin has a nice plugin that shows the XML that it sends and receives. 
I would install that as well and see what comes up.
> 
> I'm skeptical that this is a bug with converse.js because I would expect
many more people to report this. But so far you're the only one (bar a few
people who struggled with prebind issues).
> 
> Good luck
> JC
> 
> >    On 30 May 2014, at 14:54, "JC Brand" <[3]lists@opkode.com> wrote:
> > 
> >      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> > 
> >          here’s the console log after a reload w/ 0.7.4:
> > 
> >          Attached converse.min.js:163< br>
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 request id 1.0 posting converse.min.js:163
> > 
> >          0 request id 1.0 state changed to 1 converse.min.js:163
> > 
> >          <body rid=​"1782556600"
> >          xmlns=​"http:​/​/​[4]jabber.org/​protocol/​httpbind"
> >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > 
> >          <iq to=​"[5]conference.jabber.domain.com"
> >          from=​"[6]user@jabber.domain.com/​39459055681401436200110264"
> >          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> > 
> >          <query
> >          
> > xmlns=​"http:​/​/​[7]jabber.org/​protocol/​disco#items">​</query>​
> > 
> >          </iq>​
> > 
> >          <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> > 
> >          <query xmlns=​"jabber:​iq:​roster">​</query>​
> > 
> >          </iq>​
> > 
> >          </body>​
> > 
> >          converse.min.js:163
> > 
> >          0 request id 1.1 state changed to 2 converse.min.js:163
> > 
> >          13
> > 
> >          0 request id 1.1 state changed to 3 converse.min.js:163
> > 
> >          0 request id 1.1 state changed to 4 converse.min.js:163
> > 
> >          0 removing request converse.min.js:163
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 request id 1 should now be removed converse.min.js:163
> > 
> >          0 request id 1.1 got 200 converse.min.js:163
> > 
> >          <body xmlns=​"http:​/​/​[8]jabber.org/​protocol/​httpbind">​
> > 
> >          <iq xmlns=​"jabber:​client" from=​"[9]user@jabber.domain.com"
> >          to=​"[10]user@jabber.domain.com/​39459055681401436200110264"
> >          id=​"6590:​roster" type=​"result">​
> > 
> >          <query xmlns=​"jabber:​iq:​ros ter">​​
> > 
> >          <item subscription=​"both" name=​"First Last"
> >          jid=​"[11]flast@jabber.domain.com">​…​</item>​
> > 
> >          </query>​
> > 
> >          </iq>​
> > 
> >          </body>​
> > 
> >          converse.min.js:163
> > 
> >          0 _throttledRequestHandler called with 0 requests
> >          converse.min.js:163
> > 
> >          0 request id 2.0 posting converse.min.js:163
> > 
> >          0 request id 2.0 state changed to 1 converse.min.js:163
> > 
> >          <body rid=​"1782556601"
> >          xmlns=​"http:​/​/​[12]jabber.org/​protocol/​httpbind"
> >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > 
> >          <presence xmlns=​"jabber:​client">​</presence>​
> > 
> >          </body>​
> > 
> >      Above you send out a presence broadcast after getting your contacts
> >      roster.
> >      The XMPP server should forward this presence to all your contac ts, and
> >      they
> >      should then return their own presences.
> > 
> >          <body xmlns=​"http:​/​/​[13]jabber.org/​protocol/​httpbind">​
> > 
> >          <presence xmlns=​"jabber:​client"
> >          from=​"[14]user@jabber.domain.com/​39459055681401436200110264"
> >          
> > to=​"[15]user@jabber.domain.com/​39459055681401436200110264">​</presen
> > ce>​
> > 
> >          </body>​
> > 
> >      Above you get your own previously sent presence sent back to you by the
> >      XMPP
> >      server.
> >      And in the rest of the debug output you posted I don't see a presen ce
> >      returned from your
> >      roster contact.
> >      So that implies that the other user is not online.
> >      What XMPP client is the other user using? Is the other user logged in
> >      with converse.js in a different browser?
> > 
> > References
> > 
> >    Visible links
> >    1. mailto:user@jabber.domain.com
> >    2. mailto:flast@jabber.domain.com
> >    3. mailto:lists@opkode.com
> >    4. http://jabber.org/
> >    5. http://conference.ja bber.domain.com/
> >    6. mailto:user@jabber.domain.com
> >    7. http://jabber.org/
> >    8. http://jabber.org/
> >    9. mailto:user@jabber.domain.com
> >   10. mailto:user@jabber.domain.com
> >   11. mailto:flast@jabber.domain.com
> >   12. http://jabber.org/
> >   13. http://jabber.org/
> >   14. mailto:user@jabber.domain.com
> >   15. mailto:user@jabber.domain.com
> 
> 

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Alexandre Coloma
Date:
2014-06-02 @ 09:25
 I try it lasy night, but if you do this, the other contacts receive your
unavailable status and shows are offline.... and you only are changing of
page in your site, the only solution that i have, is store presence status
during page reload....


2014-06-02 10:38 GMT+02:00 JC Brand <lists@opkode.com>:

> On Mon, Jun 02, 2014 at 07:16:29AM +0000, Anton Popov wrote:
> > Hi, thanks for your mail.
> > What should $pres contain?
> > Sorry if stupid question, I am a sysadmin and javascript is not a native
> language for me.
>
> $pres is a Strophe.js function that builds a <presence> XML stanza.
>
> What Andrei says makes perfect sense. From the perspective of your roster
> contacts, you have already on the first page-load broadcasted your
> presence and
> they then responded by broadcasting theirs.
>
> When you reload the page and broadcast your presence again, your chat
> status is
> the same, so they ignore it and don't respond by broadcasting their
> presences
> again.
>
> The solution appears to be to add a handler for the "onbeforeunload" event
> (fired
> before the page refreshes) which sends a presence of type unavailable.
>
> And then when the new page as loaded, a normal presence stanza is sent
> again.
>
> This should fix the problem.
>
> I've created a new ticket for this:
> https://github.com/jcbrand/converse.js/issues/175
>
> Thanks Andrei for the explanation!
>
>
> > -----Original Message-----
> > From: conversejs@librelist.com [mailto:conversejs@librelist.com] On
> Behalf Of Andrei Charepka
> > Sent: Friday, May 30, 2014 19:04
> > To: conversejs@librelist.com
> > Subject: RE: [conversejs] Re: [converse.js] noone online after reload w/
> prebind (#169)
> >
> > I encountered the same issue with prebind -- my own presence would be
> set, but all the contacts are offline. Their presence is eventually updated
> (10-15 minutes).
> >
> > I found that sending an offline presence and then sending online causes
> the roster to be refreshed.
> >
> > In my function that is called when converse is initialized, I do the
> following (if it's a pre-bind):
> >
> > converse.connection.send($pres({type: "unavailable"}));
> converse.connection.send($pres());
> >
> > Here's a link to a discussion of a similar issue:
> https://groups.google.com/forum/#!topic/strophe/XWpvMx7MS_w
> >
> > Andrei
> >
> > -----Original Message-----
> > From: conversejs@librelist.com [mailto:conversejs@librelist.com] On
> Behalf Of JC Brand
> > Sent: Friday, May 30, 2014 11:58 AM
> > To: conversejs@librelist.com
> > Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/
> prebind (#169)
> >
> > On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
> > >    Hi
> > >    I removed a lot of lines from the log as i thought they were
> redundant.
> >
> > The bits that are important are the XML stanzas.
> >
> > >    In here where the empty line is are i think all users in the
> roster, not
> > >    just online.
> >
> > The IQ stanza returned from the XMPP server has all your roster contacts
> yes.
> >
> > >    The jabber server has at all times at least 20 users online, often
> more.
> > >    All use ichat/pidgin as i am testing converse.js and only i,
> > >    [1]user@jabber.domain.com in this log use converse.
> >
> > When you reload the page with converse.js, does your user appear as an
> online contact in ichat/pidgin or not?
> >
> > >    Do you want the log from the initial page load, before the page
> reload?
> > >
> > >        <query xmlns=​"jabber:​iq:​roster">​​
> > >
> > >        <item subscription=​"both" name=​"First Last"
> > >        jid=​"[2]flast@jabber.domain.com">​…​</item>​
> > >
> > >          </query>​
> >
> > No, what happens before the page is reloaded is not relevant AFAIK.
> >
> > To be honest, I don't know what the problem is here. From what I can
> tell from the log you posted, Converse.js *does* broadcast your presence
> when you reload the page, but doesn't get any presences back from other
> users.
> >
> > If converse.js doesn't get any presences back, there's not much it can
> do or be responsible for.
> >
> > The last times there was an issue similar to this, it was either that
> >
> > 1. converse didn't broadcast the user's presence upon page reload, or 2.
> converse wasn't ready to receive other users' presences once they started
> appearing.
> >
> > Neither of these 2 issues appear to be the case here.
> >
> > Are you sure it's not a problem with prebinding? Are you 100% sure that
> you are logged in when you reload the page?
> >
> > All I can suggest is that you continue debugging. For example, checking
> your server logs to see what they say when you reload converse.
> >
> > Pidgin has a nice plugin that shows the XML that it sends and receives.
> I would install that as well and see what comes up.
> >
> > I'm skeptical that this is a bug with converse.js because I would expect
> many more people to report this. But so far you're the only one (bar a few
> people who struggled with prebind issues).
> >
> > Good luck
> > JC
> >
> > >    On 30 May 2014, at 14:54, "JC Brand" <[3]lists@opkode.com> wrote:
> > >
> > >      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
> > >
> > >          here’s the console log after a reload w/ 0.7.4:
> > >
> > >          Attached converse.min.js:163< br>
> > >
> > >          0 _throttledRequestHandler called with 0 requests
> > >          converse.min.js:163
> > >
> > >          0 _throttledRequestHandler called with 0 requests
> > >          converse.min.js:163
> > >
> > >          0 request id 1.0 posting converse.min.js:163
> > >
> > >          0 request id 1.0 state changed to 1 converse.min.js:163
> > >
> > >          <body rid=​"1782556600"
> > >          xmlns=​"http:​/​/​[4]jabber.org/​protocol/​httpbind"
> > >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > >
> > >          <iq to=​"[5]conference.jabber.domain.com"
> > >          from=​"[6]user@jabber.domain.com/​39459055681401436200110264"
> > >          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
> > >
> > >          <query
> > >
> > > xmlns=​"http:​/​/​[7]jabber.org/​protocol/​disco#items">​</query>​
> > >
> > >          </iq>​
> > >
> > >          <iq type=​"get" id=​"6590:​roster" xmlns=​"jabber:​client">​
> > >
> > >          <query xmlns=​"jabber:​iq:​roster">​</query>​
> > >
> > >          </iq>​
> > >
> > >          </body>​
> > >
> > >          converse.min.js:163
> > >
> > >          0 request id 1.1 state changed to 2 converse.min.js:163
> > >
> > >          13
> > >
> > >          0 request id 1.1 state changed to 3 converse.min.js:163
> > >
> > >          0 request id 1.1 state changed to 4 converse.min.js:163
> > >
> > >          0 removing request converse.min.js:163
> > >
> > >          0 _throttledRequestHandler called with 0 requests
> > >          converse.min.js:163
> > >
> > >          0 request id 1 should now be removed converse.min.js:163
> > >
> > >          0 request id 1.1 got 200 converse.min.js:163
> > >
> > >          <body xmlns=​"http:​/​/​[8]jabber.org/​protocol/​httpbind">​
> > >
> > >          <iq xmlns=​"jabber:​client" from=​"[9]user@jabber.domain.com"
> > >          to=​"[10]user@jabber.domain.com/​39459055681401436200110264"
> > >          id=​"6590:​roster" type=​"result">​
> > >
> > >          <query xmlns=​"jabber:​iq:​ros ter">​​
> > >
> > >          <item subscription=​"both" name=​"First Last"
> > >          jid=​"[11]flast@jabber.domain.com">​…​</item>​
> > >
> > >          </query>​
> > >
> > >          </iq>​
> > >
> > >          </body>​
> > >
> > >          converse.min.js:163
> > >
> > >          0 _throttledRequestHandler called with 0 requests
> > >          converse.min.js:163
> > >
> > >          0 request id 2.0 posting converse.min.js:163
> > >
> > >          0 request id 2.0 state changed to 1 converse.min.js:163
> > >
> > >          <body rid=​"1782556601"
> > >          xmlns=​"http:​/​/​[12]jabber.org/​protocol/​httpbind"
> > >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
> > >
> > >          <presence xmlns=​"jabber:​client">​</presence>​
> > >
> > >          </body>​
> > >
> > >      Above you send out a presence broadcast after getting your
> contacts
> > >      roster.
> > >      The XMPP server should forward this presence to all your contac
> ts, and
> > >      they
> > >      should then return their own presences.
> > >
> > >          <body xmlns=​"http:​/​/​[13]jabber.org/​protocol/​httpbind">​
> > >
> > >          <presence xmlns=​"jabber:​client"
> > >          from=​"[14]user@jabber.domain.com/
> ​39459055681401436200110264"
> > >
> > > to=​"[15]user@jabber.domain.com/​39459055681401436200110264">​</presen
> > > ce>​
> > >
> > >          </body>​
> > >
> > >      Above you get your own previously sent presence sent back to you
> by the
> > >      XMPP
> > >      server.
> > >      And in the rest of the debug output you posted I don't see a
> presen ce
> > >      returned from your
> > >      roster contact.
> > >      So that implies that the other user is not online.
> > >      What XMPP client is the other user using? Is the other user
> logged in
> > >      with converse.js in a different browser?
> > >
> > > References
> > >
> > >    Visible links
> > >    1. mailto:user@jabber.domain.com
> > >    2. mailto:flast@jabber.domain.com
> > >    3. mailto:lists@opkode.com
> > >    4. http://jabber.org/
> > >    5. http://conference.ja bber.domain.com/
> > >    6. mailto:user@jabber.domain.com
> > >    7. http://jabber.org/
> > >    8. http://jabber.org/
> > >    9. mailto:user@jabber.domain.com
> > >   10. mailto:user@jabber.domain.com
> > >   11. mailto:flast@jabber.domain.com
> > >   12. http://jabber.org/
> > >   13. http://jabber.org/
> > >   14. mailto:user@jabber.domain.com
> > >   15. mailto:user@jabber.domain.com
> >
> >
>
>
>

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-06-03 @ 11:15
On Mon, Jun 02, 2014 at 11:25:27AM +0200, Alexandre Coloma wrote:
>     I try it lasy night, but if you do this, the other contacts receive your
>    unavailable status and shows are offline.... and you only are changing of
>    page in your site,
>    the only solution that i have, is store presence status
>    during page reload.... 

I think storing the presence status is probably the best solution, but only 
if sessionStorage is used and not localStorage.

With localStorage, the presences would be cached beyond the current session,
thereby giving the wrong impression when someone opens a page with converse.js
much later.

Additionally, I'm not 100% sure whether offline users will broadcast their
offline status when you initially broadcast your own status. I think they might
just not respond (the implication being that they are offline). If this is
true, then a cached a state of "online" for them will not be corrected upon
page load.
 
>    2014-06-02 10:38 GMT+02:00 JC Brand <[1]lists@opkode.com>:
> 
>      On Mon, Jun 02, 2014 at 07:16:29AM +0000, Anton Popov wrote:
>      > Hi, thanks for your mail.
>      > What should $pres contain?
>      > Sorry if stupid question, I am a sysadmin and javascript is not a
>      native language for me.
> 
>      $pres is a Strophe.js function that builds a <presence> XML stanza.
> 
>      What Andrei says makes perfect sense. From the perspective of your
>      roster
>      contacts, you have already on the first page-load broadcasted your
>      presence and
>      they then responded by broadcasting theirs.
> 
>      When you reload the page and broadcast your presence again, your chat
>      status is
>      the same, so they ignore it and don't respond by broadcasting their
>      presences
>      again.
> 
>      The solution appears to be to add a handler for the "onbeforeunload"
>      event (fired
>      before the page refreshes) which sends a presence of type unavailable.
> 
>      And then when the new page as loaded, a normal presence stanza is sent
>      again.
> 
>      This should fix the problem.
> 
>      I've created a new ticket for this:
>      [2]https://github.com/jcbrand/converse.js/issues/175
> 
>      Thanks Andrei for the explanation!
> 
>      > -----Original Message-----
>      > From: [3]conversejs@librelist.com [mailto:[4]conversejs@librelist.com]
>      On Behalf Of Andrei Charepka
>      > Sent: Friday, May 30, 2014 19:04
>      > To: [5]conversejs@librelist.com
>      > Subject: RE: [conversejs] Re: [converse.js] noone online after reload
>      w/ prebind (#169)
>      >
>      > I encountered the same issue with prebind -- my own presence would be
>      set, but all the contacts are offline. Their presence is eventually
>      updated (10-15 minutes).
>      >
>      > I found that sending an offline presence and then sending online
>      causes the roster to be refreshed.
>      >
>      > In my function that is called when converse is initialized, I do the
>      following (if it's a pre-bind):
>      >
>      > converse.connection.send($pres({type: "unavailable"}));
>      converse.connection.send($pres());
>      >
>      > Here's a link to a discussion of a similar issue:
>      [6]https://groups.google.com/forum/#!topic/strophe/XWpvMx7MS_w
>      >
>      > Andrei
>      >
>      > -----Original Message-----
>      > From: [7]conversejs@librelist.com [mailto:[8]conversejs@librelist.com]
>      On Behalf Of JC Brand
>      > Sent: Friday, May 30, 2014 11:58 AM
>      > To: [9]conversejs@librelist.com
>      > Subject: Re: [conversejs] Re: [converse.js] noone online after reload
>      w/ prebind (#169)
>      >
>      > On Fri, May 30, 2014 at 01:07:01PM +0000, Anton Popov wrote:
>      > >    Hi
>      > >    I removed a lot of lines from the log as i thought they were
>      redundant.
>      >
>      > The bits that are important are the XML stanzas.
>      >
>      > >    In here where the empty line is are i think all users in the
>      roster, not
>      > >    just online.
>      >
>      > The IQ stanza returned from the XMPP server has all your roster
>      contacts yes.
>      >
>      > >    The jabber server has at all times at least 20 users online,
>      often more.
>      > >    All use ichat/pidgin as i am testing converse.js and only i,
>      > >    [1][10]user@jabber.domain.com in this log use converse.
>      >
>      > When you reload the page with converse.js, does your user appear as an
>      online contact in ichat/pidgin or not?
>      >
>      > >    Do you want the log from the initial page load, before the page
>      reload?
>      > >
>      > >        <query xmlns=​"jabber:​iq:​roster">​​
>      > >
>      > >        <item subscription=​"both" name=​"First Last"
>      > >        jid=​"[2][11]flast@jabber.domain.com">​…​</item>​
>      > >
>      > >          </query>​
>      >
>      > No, what happens before the page is reloaded is not relevant AFAIK.
>      >
>      > To be honest, I don't know what the problem is here. From what I can
>      tell from the log you posted, Converse.js *does* broadcast your presence
>      when you reload the page, but doesn't get any presences back from other
>      users.
>      >
>      > If converse.js doesn't get any presences back, there's not much it can
>      do or be responsible for.
>      >
>      > The last times there was an issue similar to this, it was either that
>      >
>      > 1. converse didn't broadcast the user's presence upon page reload, or
>      2. converse wasn't ready to receive other users' presences once they
>      started appearing.
>      >
>      > Neither of these 2 issues appear to be the case here.
>      >
>      > Are you sure it's not a problem with prebinding? Are you 100% sure
>      that you are logged in when you reload the page?
>      >
>      > All I can suggest is that you continue debugging. For example,
>      checking your server logs to see what they say when you reload converse.
>      >
>      > Pidgin has a nice plugin that shows the XML that it sends and
>      receives. I would install that as well and see what comes up.
>      >
>      > I'm skeptical that this is a bug with converse.js because I would
>      expect many more people to report this. But so far you're the only one
>      (bar a few people who struggled with prebind issues).
>      >
>      > Good luck
>      > JC
>      >
>      > >    On 30 May 2014, at 14:54, "JC Brand" <[3][12]lists@opkode.com>
>      wrote:
>      > >
>      > >      On Fri, May 30, 2014 at 08:40:19AM +0000, Anton Popov wrote:
>      > >
>      > >          here’s the console log after a reload w/ 0.7.4:
>      > >
>      > >          Attached converse.min.js:163< br>
>      > >
>      > >          0 _throttledRequestHandler called with 0 requests
>      > >          converse.min.js:163
>      > >
>      > >          0 _throttledRequestHandler called with 0 requests
>      > >          converse.min.js:163
>      > >
>      > >          0 request id 1.0 posting converse.min.js:163
>      > >
>      > >          0 request id 1.0 state changed to 1 converse.min.js:163
>      > >
>      > >          <body rid=​"1782556600"
>      > >          xmlns=​"http:​/​/​[4][13]jabber.org/​protocol/​httpbind"
>      > >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
>      > >
>      > >          <iq to=​"[5][14]conference.jabber.domain.com"
>      > >        
>       from=​"[6][15]user@jabber.domain.com/​39459055681401436200110264"
>      > >          type=​"get" xmlns=​"jabber:​client" id=​"6589:​sendIQ">​
>      > >
>      > >          <query
>      > >
>      > >
>      xmlns=​"http:​/​/​[7][16]jabber.org/​protocol/​disco#items">​</query>​
>      > >
>      > >          </iq>​
>      > >
>      > >          <iq type=​"get" id=​"6590:​roster"
>      xmlns=​"jabber:​client">​
>      > >
>      > >          <query xmlns=​"jabber:​iq:​roster">​</query>​
>      > >
>      > >          </iq>​
>      > >
>      > >          </body>​
>      > >
>      > >          converse.min.js:163
>      > >
>      > >          0 request id 1.1 state changed to 2 converse.min.js:163
>      > >
>      > >          13
>      > >
>      > >          0 request id 1.1 state changed to 3 converse.min.js:163
>      > >
>      > >          0 request id 1.1 state changed to 4 converse.min.js:163
>      > >
>      > >          0 removing request converse.min.js:163
>      > >
>      > >          0 _throttledRequestHandler called with 0 requests
>      > >          converse.min.js:163
>      > >
>      > >          0 request id 1 should now be removed converse.min.js:163
>      > >
>      > >          0 request id 1.1 got 200 converse.min.js:163
>      > >
>      > >          <body
>      xmlns=​"http:​/​/​[8][17]jabber.org/​protocol/​httpbind">​
>      > >
>      > >          <iq xmlns=​"jabber:​client"
>      from=​"[9][18]user@jabber.domain.com"
>      > >        
>       to=​"[10][19]user@jabber.domain.com/​39459055681401436200110264"
>      > >          id=​"6590:​roster" type=​"result">​
>      > >
>      > >          <query xmlns=​"jabber:​iq:​ros ter">​​
>      > >
>      > >          <item subscription=​"both" name=​"First Last"
>      > >          jid=​"[11][20]flast@jabber.domain.com">​…​</item>​
>      > >
>      > >          </query>​
>      > >
>      > >          </iq>​
>      > >
>      > >          </body>​
>      > >
>      > >          converse.min.js:163
>      > >
>      > >          0 _throttledRequestHandler called with 0 requests
>      > >          converse.min.js:163
>      > >
>      > >          0 request id 2.0 posting converse.min.js:163
>      > >
>      > >          0 request id 2.0 state changed to 1 converse.min.js:163
>      > >
>      > >          <body rid=​"1782556601"
>      > >          xmlns=​"http:​/​/​[12][21]jabber.org/​protocol/​httpbind"
>      > >          sid=​"32575c99a29351ba126b8a468f4b309868476d1c">​
>      > >
>      > >          <presence xmlns=​"jabber:​client">​</presence>​
>      > >
>      > >          </body>​
>      > >
>      > >      Above you send out a presence broadcast after getting your
>      contacts
>      > >      roster.
>      > >      The XMPP server should forward this presence to all your contac
>      ts, and
>      > >      they
>      > >      should then return their own presences.
>      > >
>      > >          <body
>      xmlns=​"http:​/​/​[13][22]jabber.org/​protocol/​httpbind">​
>      > >
>      > >          <presence xmlns=​"jabber:​client"
>      > >        
>       from=​"[14][23]user@jabber.domain.com/​39459055681401436200110264"
>      > >
>      > >
>      to=​"[15][24]user@jabber.domain.com/​39459055681401436200110264">​</presen
>      > > ce>​
>      > >
>      > >          </body>​
>      > >
>      > >      Above you get your own previously sent presence sent back to
>      you by the
>      > >      XMPP
>      > >      server.
>      > >      And in the rest of the debug output you posted I don't see a
>      presen ce
>      > >      returned from your
>      > >      roster contact.
>      > >      So that implies that the other user is not online.
>      > >      What XMPP client is the other user using? Is the other user
>      logged in
>      > >      with converse.js in a different browser?
>      > >
>      > > References
>      > >
>      > >    Visible links
>      > >    1. mailto:[25]user@jabber.domain.com
>      > >    2. mailto:[26]flast@jabber.domain.com
>      > >    3. mailto:[27]lists@opkode.com
>      > >    4. [28]http://jabber.org/
>      > >    5. [29]http://conference.ja [30]bber.domain.com/
>      > >    6. mailto:[31]user@jabber.domain.com
>      > >    7. [32]http://jabber.org/
>      > >    8. [33]http://jabber.org/
>      > >    9. mailto:[34]user@jabber.domain.com
>      > >   10. mailto:[35]user@jabber.domain.com
>      > >   11. mailto:[36]flast@jabber.domain.com
>      > >   12. [37]http://jabber.org/
>      > >   13. [38]http://jabber.org/
>      > >   14. mailto:[39]user@jabber.domain.com
>      > >   15. mailto:[40]user@jabber.domain.com
>      >
>      >
> 
> References
> 
>    Visible links
>    1. mailto:lists@opkode.com
>    2. https://github.com/jcbrand/converse.js/issues/175
>    3. mailto:conversejs@librelist.com
>    4. mailto:conversejs@librelist.com
>    5. mailto:conversejs@librelist.com
>    6. https://groups.google.com/forum/#!topic/strophe/XWpvMx7MS_w
>    7. mailto:conversejs@librelist.com
>    8. mailto:conversejs@librelist.com
>    9. mailto:conversejs@librelist.com
>   10. mailto:user@jabber.domain.com
>   11. mailto:flast@jabber.domain.com
>   12. mailto:lists@opkode.com
>   13. http://jabber.org/
>   14. http://conference.jabber.domain.com/
>   15. http://user@jabber.domain.com/
>   16. http://jabber.org/
>   17. http://jabber.org/
>   18. mailto:user@jabber.domain.com
>   19. http://user@jabber.domain.com/
>   20. mailto:flast@jabber.domain.com
>   21. http://jabber.org/
>   22. http://jabber.org/
>   23. http://user@jabber.domain.com/
>   24. http://user@jabber.domain.com/
>   25. mailto:user@jabber.domain.com
>   26. mailto:flast@jabber.domain.com
>   27. mailto:lists@opkode.com
>   28. http://jabber.org/
>   29. http://conference.ja/
>   30. http://bber.domain.com/
>   31. mailto:user@jabber.domain.com
>   32. http://jabber.org/
>   33. http://jabber.org/
>   34. mailto:user@jabber.domain.com
>   35. mailto:user@jabber.domain.com
>   36. mailto:flast@jabber.domain.com
>   37. http://jabber.org/
>   38. http://jabber.org/
>   39. mailto:user@jabber.domain.com
>   40. mailto:user@jabber.domain.com

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Rodolfo Gonzalez
Date:
2014-06-06 @ 02:17
Wow, what a long thread. I started another one on the same topic a while
back, last message posted on April 11th. I had exactly the same problem. I
was shown offline to users connected with another client, Exodus, for
instance, even if pre-bind worked fine.

The last message from JC on that thread was:

------------------
This is now after automatically reconnecting?

Check these two places in the code, and see if they ever get called after
reconnection:

* presenceHandler:
https://github.com/jcbrand/converse.js/blob/master/converse.js#L2915
* rosterHandler:
https://github.com/jcbrand/converse.js/blob/master/converse.js#L2813
------------------

Would it help to continue on this path?

Regards.

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-06-06 @ 07:59
Hi Rodolfo

I think the problem has become relatively clear in this thread.

Contacts who have already broadcasted their presence to you, will 
apparently not do it
again if you broadcast your own presence unchanged.

When a page is reloaded, Converse.js rebroadcasts your presence (even though it
hasn't changed), expecting that the contacts will all broadcast their own
presences back as well.

However, that appears to not be the case in some instances.

I'm wondering whether this is XMPP-server specific. In other words, whether
some XMPP servers will rebroadcast and others not.

I'm using ejabberd for prebinding and haven't run into this issue.

On how to fix it... there are 2 approaches. Either set the user status to
offline just before the page is reloaded or cache the roster contact's
statuses.

The second option is not such a good idea with localStorage, which we use
currently, but will be if we switch to sessionStorage.

This won't happen quickly though because it's a significant amount of work.

So for now, the workaround is the first option.

Regards
JC

On Thu, Jun 05, 2014 at 09:17:12PM -0500, Rodolfo Gonzalez wrote:
>    Wow, what a long thread. I started another one on the same topic a while
>    back, last message posted on April 11th. I had exactly the same problem. I
>    was shown offline to users connected with another client, Exodus, for
>    instance, even if pre-bind worked fine.
> 
>    The last message from JC on that thread was:
> 
>    ------------------
>    This is now after automatically reconnecting?
> 
>    Check these two places in the code, and see if they ever get called after
>    reconnection:
> 
>    * presenceHandler:
>    [1]https://github.com/jcbrand/converse.js/blob/master/converse.js#L2915
>    * rosterHandler:
>    [2]https://github.com/jcbrand/converse.js/blob/master/converse.js#L2813
>    ------------------
> 
>    Would it help to continue on this path?
> 
>    Regards.
> 
> References
> 
>    Visible links
>    1. https://github.com/jcbrand/converse.js/blob/master/converse.js#L2915
>    2. https://github.com/jcbrand/converse.js/blob/master/converse.js#L2813

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Anton Popov
Date:
2014-06-06 @ 08:05
Hi,

Right, but how to actually implement the first approach?
I am also using ejabberd.

I have this at the moment:

<!DOCTYPE html>
<html>
    <head>
        <meta charset='utf-8' />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
/>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
        <meta name="description" content="coversejs" />
          <link rel="stylesheet" type="text/css" media="screen"
href="stylesheets/stylesheet.css">
        <link rel="stylesheet" type="text/css" media="screen"
href="converse/converse.min.css">
        <script src="converse/builds/converse.min.js"></script>
        <title>Converse.js</title>
    </head>

    <body>
        <div id="conversejs"></div>

    </body>
    <script>

        require(['converse'], function(converse) {
            var info;
 if (localStorage && localStorage.converse) {

info = JSON.parse(localStorage.converse).info;

}
            if (localStorage && localStorage.converse && info.sid ) {
                converse.initialize({
                    prebind: true,
                    jid: info.jid,
                    sid: info.sid,
                    rid: info.rid,
                    allow_otr: true,
                    auto_list_rooms: false,
                    allow_muc: false,
                    auto_subscribe: true,
                    auto_reconnect: true,
                    bosh_service_url: 'https://domain/http-bind',
                    debug: true,
                    hide_muc_server: true,
                    i18n: locales['en'],
                    use_otr_by_default: true,
                    show_only_online_users: true,
                    xhr_user_search: false
                }, function() {
                    var that = this;
                    $(window).unload(function(event) {
                        if (typeof that.connection !== "undefined") {
                            localStorage.setItem('converse',
JSON.stringify({
                                info: {
                                    jid: that.connection.jid,
                                    rid: that.connection.rid,
                                    sid: that.connection.sid
                                }
                            }));
                        }
                    });
                });
            } else {
                converse.initialize({
                    allow_otr: true,
                    auto_list_rooms: false,
                    auto_subscribe: true,
                    bosh_service_url: 'https://domain/http-bind',
                    debug: true,
                    hide_muc_server: true,
                    allow_muc: false,
                    i18n: locales['en'],
                    use_otr_by_default: true,
                    show_only_online_users: true,
                    xhr_user_search: false
                }, function() {
                    var that = this;
                    $(window).unload(function(event) {
                        if (typeof that.connection !== "undefined") {
                            localStorage.setItem('converse',
JSON.stringify({
                                info: {
                                    jid: that.connection.jid,
                                    rid: that.connection.rid,
                                    sid: that.connection.sid
                                }
                            }));
                        }
                    });
                });
            }
        });
    </script>
</html>

-----Original Message-----
From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf
Of JC Brand
Sent: Friday, June 6, 2014 10:00
To: conversejs@librelist.com
Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/
prebind (#169)

Hi Rodolfo

I think the problem has become relatively clear in this thread.

Contacts who have already broadcasted their presence to you, will apparently
not do it again if you broadcast your own presence unchanged.

When a page is reloaded, Converse.js rebroadcasts your presence (even though
it hasn't changed), expecting that the contacts will all broadcast their own
presences back as well.

However, that appears to not be the case in some instances.

I'm wondering whether this is XMPP-server specific. In other words, whether
some XMPP servers will rebroadcast and others not.

I'm using ejabberd for prebinding and haven't run into this issue.

On how to fix it... there are 2 approaches. Either set the user status to
offline just before the page is reloaded or cache the roster contact's
statuses.

The second option is not such a good idea with localStorage, which we use
currently, but will be if we switch to sessionStorage.

This won't happen quickly though because it's a significant amount of work.

So for now, the workaround is the first option.

Regards
JC

On Thu, Jun 05, 2014 at 09:17:12PM -0500, Rodolfo Gonzalez wrote:
>    Wow, what a long thread. I started another one on the same topic a
while
>    back, last message posted on April 11th. I had exactly the same
problem. I
>    was shown offline to users connected with another client, Exodus, for
>    instance, even if pre-bind worked fine.
> 
>    The last message from JC on that thread was:
> 
>    ------------------
>    This is now after automatically reconnecting?
> 
>    Check these two places in the code, and see if they ever get called
after
>    reconnection:
> 
>    * presenceHandler:
>    [1]https://github.com/jcbrand/converse.js/blob/master/converse.js#L2915
>    * rosterHandler:
>    [2]https://github.com/jcbrand/converse.js/blob/master/converse.js#L2813
>    ------------------
> 
>    Would it help to continue on this path?
> 
>    Regards.
> 
> References
> 
>    Visible links
>    1. https://github.com/jcbrand/converse.js/blob/master/converse.js#L2915
>    2. 
> https://github.com/jcbrand/converse.js/blob/master/converse.js#L2813

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-06-06 @ 08:45
On Fri, Jun 06, 2014 at 08:05:49AM +0000, Anton Popov wrote:
> Hi,
> 
> Right, but how to actually implement the first approach?

I've already mentioned previously in the thread how I think the first approach
should be handled. It's a variation of what Andrei wrote.

Andrei said he sets his presence to unavailable and then back to online AFTER
the page has loaded.

>   converse.connection.send($pres({type: "unavailable"}));
>   converse.connection.send($pres());

I propose that it's better to do it BEFORE reloading the page, via the 
"onbeforeunload" event.

You'll have to do this from within in the converse.js code, not from the
outside as in the code you pasted below.

A pull request will be appreciated if you do this.

- JC


> I am also using ejabberd.
> 
> I have this at the moment:
> 
> <!DOCTYPE html>
> <html>
>     <head>
>         <meta charset='utf-8' />
>         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
> />
>         <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
>         <meta name="description" content="coversejs" />
>           <link rel="stylesheet" type="text/css" media="screen"
> href="stylesheets/stylesheet.css">
>         <link rel="stylesheet" type="text/css" media="screen"
> href="converse/converse.min.css">
>         <script src="converse/builds/converse.min.js"></script>
>         <title>Converse.js</title>
>     </head>
> 
>     <body>
>         <div id="conversejs"></div>
> 
>     </body>
>     <script>
> 
>         require(['converse'], function(converse) {
>             var info;
>  if (localStorage && localStorage.converse) {
> 
> info = JSON.parse(localStorage.converse).info;
> 
> }
>             if (localStorage && localStorage.converse && info.sid ) {
>                 converse.initialize({
>                     prebind: true,
>                     jid: info.jid,
>                     sid: info.sid,
>                     rid: info.rid,
>                     allow_otr: true,
>                     auto_list_rooms: false,
>                     allow_muc: false,
>                     auto_subscribe: true,
>                     auto_reconnect: true,
>                     bosh_service_url: 'https://domain/http-bind',
>                     debug: true,
>                     hide_muc_server: true,
>                     i18n: locales['en'],
>                     use_otr_by_default: true,
>                     show_only_online_users: true,
>                     xhr_user_search: false
>                 }, function() {
>                     var that = this;
>                     $(window).unload(function(event) {
>                         if (typeof that.connection !== "undefined") {
>                             localStorage.setItem('converse',
> JSON.stringify({
>                                 info: {
>                                     jid: that.connection.jid,
>                                     rid: that.connection.rid,
>                                     sid: that.connection.sid
>                                 }
>                             }));
>                         }
>                     });
>                 });
>             } else {
>                 converse.initialize({
>                     allow_otr: true,
>                     auto_list_rooms: false,
>                     auto_subscribe: true,
>                     bosh_service_url: 'https://domain/http-bind',
>                     debug: true,
>                     hide_muc_server: true,
>                     allow_muc: false,
>                     i18n: locales['en'],
>                     use_otr_by_default: true,
>                     show_only_online_users: true,
>                     xhr_user_search: false
>                 }, function() {
>                     var that = this;
>                     $(window).unload(function(event) {
>                         if (typeof that.connection !== "undefined") {
>                             localStorage.setItem('converse',
> JSON.stringify({
>                                 info: {
>                                     jid: that.connection.jid,
>                                     rid: that.connection.rid,
>                                     sid: that.connection.sid
>                                 }
>                             }));
>                         }
>                     });
>                 });
>             }
>         });
>     </script>
> </html>
> 
> -----Original Message-----
> From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf
> Of JC Brand
> Sent: Friday, June 6, 2014 10:00
> To: conversejs@librelist.com
> Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/
> prebind (#169)
> 
> Hi Rodolfo
> 
> I think the problem has become relatively clear in this thread.
> 
> Contacts who have already broadcasted their presence to you, will apparently
> not do it again if you broadcast your own presence unchanged.
> 
> When a page is reloaded, Converse.js rebroadcasts your presence (even though
> it hasn't changed), expecting that the contacts will all broadcast their own
> presences back as well.
> 
> However, that appears to not be the case in some instances.
> 
> I'm wondering whether this is XMPP-server specific. In other words, whether
> some XMPP servers will rebroadcast and others not.
> 
> I'm using ejabberd for prebinding and haven't run into this issue.
> 
> On how to fix it... there are 2 approaches. Either set the user status to
> offline just before the page is reloaded or cache the roster contact's
> statuses.
> 
> The second option is not such a good idea with localStorage, which we use
> currently, but will be if we switch to sessionStorage.
> 
> This won't happen quickly though because it's a significant amount of work.
> 
> So for now, the workaround is the first option.
> 
> Regards
> JC
> 
> On Thu, Jun 05, 2014 at 09:17:12PM -0500, Rodolfo Gonzalez wrote:
> >    Wow, what a long thread. I started another one on the same topic a
> while
> >    back, last message posted on April 11th. I had exactly the same
> problem. I
> >    was shown offline to users connected with another client, Exodus, for
> >    instance, even if pre-bind worked fine.
> > 
> >    The last message from JC on that thread was:
> > 
> >    ------------------
> >    This is now after automatically reconnecting?
> > 
> >    Check these two places in the code, and see if they ever get called
> after
> >    reconnection:
> > 
> >    * presenceHandler:
> >    [1]https://github.com/jcbrand/converse.js/blob/master/converse.js#L2915
> >    * rosterHandler:
> >    [2]https://github.com/jcbrand/converse.js/blob/master/converse.js#L2813
> >    ------------------
> > 
> >    Would it help to continue on this path?
> > 
> >    Regards.
> > 
> > References
> > 
> >    Visible links
> >    1. https://github.com/jcbrand/converse.js/blob/master/converse.js#L2915
> >    2. 
> > https://github.com/jcbrand/converse.js/blob/master/converse.js#L2813

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Rodolfo Gonzalez
Date:
2014-06-14 @ 05:36
>2014-06-06 3:45 GMT-05:00 JC Brand <lists@opkode.com>:
>On Fri, Jun 06, 2014 at 08:05:49AM +0000, Anton Popov wrote:
>> Hi,
>>
>> Right, but how to actually implement the first approach?
>
> I've already mentioned previously in the thread how I think the first
approach
> should be handled. It's a variation of what Andrei wrote.
>
> Andrei said he sets his presence to unavailable and then back to online
AFTER
> the page has loaded.
>
>>   converse.connection.send($pres({type: "unavailable"}));
>>   converse.connection.send($pres());
>
> I propose that it's better to do it BEFORE reloading the page, via the
"onbeforeunload" event.
> You'll have to do this from within in the converse.js code, not from the
> outside as in the code you pasted below.


Thank you JC, may you hint where to place those calls? :)

Thanks again.

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-06-14 @ 20:14
On Sat, Jun 14, 2014 at 12:36:09AM -0500, Rodolfo Gonzalez wrote:
>    >2014-06-06 3:45 GMT-05:00 JC Brand <[1]lists@opkode.com>:
>    >On Fri, Jun 06, 2014 at 08:05:49AM +0000, Anton Popov wrote:
>    >> Hi,
>    >>
>    >> Right, but how to actually implement the first approach?
>    >
>    > I've already mentioned previously in the thread how I think the first
>    approach
>    > should be handled. It's a variation of what Andrei wrote.
>    >
>    > Andrei said he sets his presence to unavailable and then back to online
>    AFTER
>    > the page has loaded.
>    >
>    >>   converse.connection.send($pres({type: "unavailable"}));
>    >>   converse.connection.send($pres());
>    >
>    > I propose that it's better to do it BEFORE reloading the page, via the
>    "onbeforeunload" event.
>    > You'll have to do this from within in the converse.js code, not from the
>    > outside as in the code you pasted below.
> 
>    Thank you JC, may you hint where to place those calls? :)

I put global event handlers in the registerGlobalEventHandlers method.

See here: https://github.com/jcbrand/converse.js/blob/master/converse.js#L497

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Rodolfo Gonzalez
Date:
2014-06-16 @ 02:02
I'm sure I'm doing something wrong here:

this.registerGlobalEventHandlers = function () {
            $(document).click(function() {
                if ($('.toggle-otr ul').is(':visible')) {
                    $('.toggle-otr ul', this).slideUp();
                }
                if ($('.toggle-smiley ul').is(':visible')) {
                    $('.toggle-smiley ul', this).slideUp();
                }
            });

            $(window).on("blur focus", $.proxy(function(e) {
                if ((this.windowState != e.type) && (e.type == 'focus')) {
                    converse.clearMsgCounter();
                }
                this.windowState = e.type;
            },this));

            $(window).on("beforeunload", function() {
               alert("hola mundo");
               converse.connection.send($pres({type: "unavailable"}));
               converse.connection.send($pres());
            });
        };


no message "hola mundo" is displayed.



2014-06-14 15:14 GMT-05:00 JC Brand <lists@opkode.com>:

> On Sat, Jun 14, 2014 at 12:36:09AM -0500, Rodolfo Gonzalez wrote:
> >    >2014-06-06 3:45 GMT-05:00 JC Brand <[1]lists@opkode.com>:
> >    >On Fri, Jun 06, 2014 at 08:05:49AM +0000, Anton Popov wrote:
> >    >> Hi,
> >    >>
> >    >> Right, but how to actually implement the first approach?
> >    >
> >    > I've already mentioned previously in the thread how I think the
> first
> >    approach
> >    > should be handled. It's a variation of what Andrei wrote.
> >    >
> >    > Andrei said he sets his presence to unavailable and then back to
> online
> >    AFTER
> >    > the page has loaded.
> >    >
> >    >>   converse.connection.send($pres({type: "unavailable"}));
> >    >>   converse.connection.send($pres());
> >    >
> >    > I propose that it's better to do it BEFORE reloading the page, via
> the
> >    "onbeforeunload" event.
> >    > You'll have to do this from within in the converse.js code, not
> from the
> >    > outside as in the code you pasted below.
> >
> >    Thank you JC, may you hint where to place those calls? :)
>
> I put global event handlers in the registerGlobalEventHandlers method.
>
> See here:
> https://github.com/jcbrand/converse.js/blob/master/converse.js#L497
>

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Rodolfo Gonzalez
Date:
2014-06-19 @ 16:04
Well, it was weird, since I had cleared the caches, but the message
appeared, which means that block of code was reached, but the statuses kept
unchanged.


2014-06-15 21:02 GMT-05:00 Rodolfo Gonzalez <metayii.framework@gmail.com>:

> I'm sure I'm doing something wrong here:
>
> this.registerGlobalEventHandlers = function () {
>             $(document).click(function() {
>                 if ($('.toggle-otr ul').is(':visible')) {
>                     $('.toggle-otr ul', this).slideUp();
>                 }
>                 if ($('.toggle-smiley ul').is(':visible')) {
>                     $('.toggle-smiley ul', this).slideUp();
>                 }
>             });
>
>             $(window).on("blur focus", $.proxy(function(e) {
>                 if ((this.windowState != e.type) && (e.type == 'focus')) {
>                     converse.clearMsgCounter();
>                 }
>                 this.windowState = e.type;
>             },this));
>
>             $(window).on("beforeunload", function() {
>                alert("hola mundo");
>
>                converse.connection.send($pres({type: "unavailable"}));
>                converse.connection.send($pres());
>             });
>         };
>
>
> no message "hola mundo" is displayed.
>
>
>
> 2014-06-14 15:14 GMT-05:00 JC Brand <lists@opkode.com>:
>
> On Sat, Jun 14, 2014 at 12:36:09AM -0500, Rodolfo Gonzalez wrote:
>> >    >2014-06-06 3:45 GMT-05:00 JC Brand <[1]lists@opkode.com>:
>> >    >On Fri, Jun 06, 2014 at 08:05:49AM +0000, Anton Popov wrote:
>> >    >> Hi,
>> >    >>
>> >    >> Right, but how to actually implement the first approach?
>> >    >
>> >    > I've already mentioned previously in the thread how I think the
>> first
>> >    approach
>> >    > should be handled. It's a variation of what Andrei wrote.
>> >    >
>> >    > Andrei said he sets his presence to unavailable and then back to
>> online
>> >    AFTER
>> >    > the page has loaded.
>> >    >
>> >    >>   converse.connection.send($pres({type: "unavailable"}));
>> >    >>   converse.connection.send($pres());
>> >    >
>> >    > I propose that it's better to do it BEFORE reloading the page, via
>> the
>> >    "onbeforeunload" event.
>> >    > You'll have to do this from within in the converse.js code, not
>> from the
>> >    > outside as in the code you pasted below.
>> >
>> >    Thank you JC, may you hint where to place those calls? :)
>>
>> I put global event handlers in the registerGlobalEventHandlers method.
>>
>> See here:
>> https://github.com/jcbrand/converse.js/blob/master/converse.js#L497
>>
>
>

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Andrei Charepka
Date:
2014-06-19 @ 17:42
Rodolfo,

I think you have an error where you are adding a handler to the 
“onbeforeunload” event. Try this instead:



window.onbeforeunload =function() {
               alert("hola mundo");

               converse.connection.send($pres({type: "unavailable"}));
               converse.connection.send($pres());
            });




Andrei

From: conversejs@librelist.com [mailto:conversejs@librelist.com] On Behalf
Of Rodolfo Gonzalez
Sent: Thursday, June 19, 2014 12:05 PM
To: conversejs@librelist.com
Subject: Re: [conversejs] Re: [converse.js] noone online after reload w/ 
prebind (#169)

Well, it was weird, since I had cleared the caches, but the message 
appeared, which means that block of code was reached, but the statuses 
kept unchanged.

2014-06-15 21:02 GMT-05:00 Rodolfo Gonzalez 
<metayii.framework@gmail.com<mailto:metayii.framework@gmail.com>>:
I'm sure I'm doing something wrong here:

this.registerGlobalEventHandlers = function () {
            $(document).click(function() {
                if ($('.toggle-otr ul').is(':visible')) {
                    $('.toggle-otr ul', this).slideUp();
                }
                if ($('.toggle-smiley ul').is(':visible')) {
                    $('.toggle-smiley ul', this).slideUp();
                }
            });

            $(window).on("blur focus", $.proxy(function(e) {
                if ((this.windowState != e.type) && (e.type == 'focus')) {
                    converse.clearMsgCounter();
                }
                this.windowState = e.type;
            },this));

            $(window).on("beforeunload", function() {
               alert("hola mundo");

               converse.connection.send($pres({type: "unavailable"}));
               converse.connection.send($pres());
            });
        };

no message "hola mundo" is displayed.

2014-06-14 15:14 GMT-05:00 JC Brand <lists@opkode.com<mailto:lists@opkode.com>>:

On Sat, Jun 14, 2014 at 12:36:09AM -0500, Rodolfo Gonzalez wrote:
>    >2014-06-06 3:45 GMT-05:00 JC Brand 
<[1]lists@opkode.com<mailto:lists@opkode.com>>:
>    >On Fri, Jun 06, 2014 at 08:05:49AM +0000, Anton Popov wrote:
>    >> Hi,
>    >>
>    >> Right, but how to actually implement the first approach?
>    >
>    > I've already mentioned previously in the thread how I think the first
>    approach
>    > should be handled. It's a variation of what Andrei wrote.
>    >
>    > Andrei said he sets his presence to unavailable and then back to online
>    AFTER
>    > the page has loaded.
>    >
>    >>   converse.connection.send($pres({type: "unavailable"}));
>    >>   converse.connection.send($pres());
>    >
>    > I propose that it's better to do it BEFORE reloading the page, via the
>    "onbeforeunload" event.
>    > You'll have to do this from within in the converse.js code, not from the
>    > outside as in the code you pasted below.
>
>    Thank you JC, may you hint where to place those calls? :)
I put global event handlers in the registerGlobalEventHandlers method.

See here: https://github.com/jcbrand/converse.js/blob/master/converse.js#L497

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Rodolfo Gonzalez
Date:
2014-06-20 @ 05:35
Hi Andrei,

that is the same as in my code, I guess, just that I'm using jQuery instead
of directly assigning the handler with pure JS. But even doing so, nothing
happens. The online contact in Exodus keeps being marked as offline in
converse.js until I load a page, even if converse.js is connected and the
count of online contacts is right.

Now, I think I posted this before in my other thread about the same
problem. When I do this (including the js alerts)

        this.onConnect = function (status, condition, reconnect) {
            var $button, $form;
            if ((status === Strophe.Status.CONNECTED) ||
                (status === Strophe.Status.ATTACHED)) {
                alert("!"); // here
                if ((typeof reconnect !== 'undefined') && (reconnect)) {
                    alert("!"); // here
                    converse.log(status === Strophe.Status.CONNECTED ?
'Reconnected' : 'Reattached');
                    converse.onReconnected();
                } else {
                    alert("!"); // here
                    converse.log(status === Strophe.Status.CONNECTED ?
'Connected' : 'Attached');
                    converse.onConnected();
                }

in converse.js, the roster is updated in this way: the online contact from
Exodus appears, but the same contact appears (or is kept) in the list as
offline. So, the Exodus contact appears both online and offline.

Weird.

P.S. Anyone knows how to reply decently from Google Mail? It's annoying to
have the full text below and it's annoying to manipulate the HTML :-\


2014-06-19 12:42 GMT-05:00 Andrei Charepka <acharepka@thinkingphones.com>:

>  Rodolfo,
>
>
>
> I think you have an error where you are adding a handler to the
> “onbeforeunload” event. Try this instead:
>
>
>
>
>
>
>
> window.onbeforeunload =function() {
>
>                alert("hola mundo");
>
>
>
>                converse.connection.send($pres({type: "unavailable"}));
>
>                converse.connection.send($pres());
>
>             });
>
>





>
>
> Andrei
>
>
>
> *From:* conversejs@librelist.com [mailto:conversejs@librelist.com] *On
> Behalf Of *Rodolfo Gonzalez
> *Sent:* Thursday, June 19, 2014 12:05 PM
>
> *To:* conversejs@librelist.com
> *Subject:* Re: [conversejs] Re: [converse.js] noone online after reload
> w/ prebind (#169)
>
>
>
> Well, it was weird, since I had cleared the caches, but the message
> appeared, which means that block of code was reached, but the statuses kept
> unchanged.
>
>
>
> 2014-06-15 21:02 GMT-05:00 Rodolfo Gonzalez <metayii.framework@gmail.com>:
>
> I'm sure I'm doing something wrong here:
>
> this.registerGlobalEventHandlers = function () {
>             $(document).click(function() {
>                 if ($('.toggle-otr ul').is(':visible')) {
>                     $('.toggle-otr ul', this).slideUp();
>                 }
>                 if ($('.toggle-smiley ul').is(':visible')) {
>                     $('.toggle-smiley ul', this).slideUp();
>                 }
>             });
>
>             $(window).on("blur focus", $.proxy(function(e) {
>                 if ((this.windowState != e.type) && (e.type == 'focus')) {
>                     converse.clearMsgCounter();
>                 }
>                 this.windowState = e.type;
>             },this));
>
>             $(window).on("beforeunload", function() {
>                alert("hola mundo");
>
>
>                converse.connection.send($pres({type: "unavailable"}));
>                converse.connection.send($pres());
>
>             });
>         };
>
>  no message "hola mundo" is displayed.
>
>
>
> 2014-06-14 15:14 GMT-05:00 JC Brand <lists@opkode.com>:
>
>
>
> On Sat, Jun 14, 2014 at 12:36:09AM -0500, Rodolfo Gonzalez wrote:
> >    >2014-06-06 3:45 GMT-05:00 JC Brand <[1]lists@opkode.com>:
>
> >    >On Fri, Jun 06, 2014 at 08:05:49AM +0000, Anton Popov wrote:
> >    >> Hi,
> >    >>
> >    >> Right, but how to actually implement the first approach?
> >    >
> >    > I've already mentioned previously in the thread how I think the
> first
> >    approach
> >    > should be handled. It's a variation of what Andrei wrote.
> >    >
> >    > Andrei said he sets his presence to unavailable and then back to
> online
> >    AFTER
> >    > the page has loaded.
> >    >
> >    >>   converse.connection.send($pres({type: "unavailable"}));
> >    >>   converse.connection.send($pres());
> >    >
> >    > I propose that it's better to do it BEFORE reloading the page, via
> the
> >    "onbeforeunload" event.
> >    > You'll have to do this from within in the converse.js code, not
> from the
> >    > outside as in the code you pasted below.
> >
> >    Thank you JC, may you hint where to place those calls? :)
>
> I put global event handlers in the registerGlobalEventHandlers method.
>
> See here:
> https://github.com/jcbrand/converse.js/blob/master/converse.js#L497
>
>
>
>
>

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Jc Brand
Date:
2014-06-25 @ 08:56
On Fri, Jun 20, 2014 at 12:35:41AM -0500, Rodolfo Gonzalez wrote:
>    Hi Andrei,
>    that is the same as in my code, I guess, just that I'm using jQuery
>    instead of directly assigning the handler with pure JS. But even doing so,
>    nothing happens. The online contact in Exodus keeps being marked as
>    offline in converse.js until I load a page, even if converse.js is
>    connected and the count of online contacts is right.
> 
>    Now, I think I posted this before in my other thread about the same
>    problem. When I do this (including the js alerts)
> 
>            this.onConnect = function (status, condition, reconnect) {
>                var $button, $form;
>                if ((status === Strophe.Status.CONNECTED) ||
>                    (status === Strophe.Status.ATTACHED)) {
>                    alert("!"); // here
>                    if ((typeof reconnect !== 'undefined') && (reconnect)) {
>                        alert("!"); // here
>                        converse.log(status === Strophe.Status.CONNECTED ?
>    'Reconnected' : 'Reattached');
>                        converse.onReconnected();
>                    } else {
>                        alert("!"); // here
>                        converse.log(status === Strophe.Status.CONNECTED ?
>    'Connected' : 'Attached');
>                        converse.onConnected();
>                    }
> 
>    in converse.js, the roster is updated in this way: the online contact from
>    Exodus appears, but the same contact appears (or is kept) in the list as
>    offline. So, the Exodus contact appears both online and offline.

If the same contact appears twice, it most likely means that upon page reload,
your user receives a new JID resource.

Each JID+resource is considered to be a separate chat-client/device. So Exodus
shows the user twice.

Re: [conversejs] Re: [converse.js] noone online after reload w/ prebind (#169)

From:
Rodolfo Gonzalez
Date:
2014-06-26 @ 13:47
2014-06-25 3:56 GMT-05:00 JC Brand <lists@opkode.com>:

> On Fri, Jun 20, 2014 at 12:35:41AM -0500, Rodolfo Gonzalez wrote:
> >    Hi Andrei,
> >    that is the same as in my code, I guess, just that I'm using jQuery
> >    instead of directly assigning the handler with pure JS. But even
> doing so,
> >    nothing happens. The online contact in Exodus keeps being marked as
> >    offline in converse.js until I load a page, even if converse.js is
> >    connected and the count of online contacts is right.
> >
> >    Now, I think I posted this before in my other thread about the same
> >    problem. When I do this (including the js alerts)
> >
> >            this.onConnect = function (status, condition, reconnect) {
> >                var $button, $form;
> >                if ((status === Strophe.Status.CONNECTED) ||
> >                    (status === Strophe.Status.ATTACHED)) {
> >                    alert("!"); // here
> >                    if ((typeof reconnect !== 'undefined') &&
> (reconnect)) {
> >                        alert("!"); // here
> >                        converse.log(status === Strophe.Status.CONNECTED ?
> >    'Reconnected' : 'Reattached');
> >                        converse.onReconnected();
> >                    } else {
> >                        alert("!"); // here
> >                        converse.log(status === Strophe.Status.CONNECTED ?
> >    'Connected' : 'Attached');
> >                        converse.onConnected();
> >                    }
> >
> >    in converse.js, the roster is updated in this way: the online contact
> from
> >    Exodus appears, but the same contact appears (or is kept) in the list
> as
> >    offline. So, the Exodus contact appears both online and offline.
>
> If the same contact appears twice, it most likely means that upon page
> reload,
> your user receives a new JID resource.
>
> Each JID+resource is considered to be a separate chat-client/device. So
> Exodus
> shows the user twice.
>


Hi, the problem is not in Exodus, but in converse.js. Anyway, if I remove
the alerts, converse.js shows the Exodus user offline as usual, even if it
is online in Exodus.