librelist archives

« back to archive

Problem with contact list - everyone is offline

Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-08-26 @ 15:10
Hi. I'm using converse.js in my job to create CRM's chat for clients, with
php and ejabberd. I have a problem with contacts list. When user is opening
CRM, he always see offline chat list, same after refresh (I have prebind
options true).

This is my debug code about roster:

<body rid=​"5802029811" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind"
sid=​"663e84de7812b648afb210d08d95bfbe6f1ad53d">​
<iq from=​"admin.test@jabber.test.pl <pawel.ochota@jabber.atsys.pl>"
id=​"enablecarbons" type=​"set" xmlns=​"jabber:​client">​
<enable xmlns=​"urn:​xmpp:​carbons:​2">​</enable>​
</iq>​
<iq type=​"get" to=​"admin.test@jabber.test.pl
<pawel.ochota@jabber.atsys.pl>" xmlns=​"jabber:​client" id=​"1:​sendIQ">​
<vcard xmlns=​"vcard-temp">​</vcard>​
</iq>​
<iq to=​"conference.jabber.test.pl <http://conference.jabber.atsys.pl/>"
from=​"admin.test@jabber.test.pl <pawel.ochota@jabber.atsys.pl>l
<pawel.ochota@jabber.atsys.pl>" type=​"get" xmlns=​"jabber:​client"
id=​"2:​sendIQ">​
<query xmlns=​"http:​/​/​jabber.org/​protocol/​disco#items">​</query>​
</iq>​
<iq type=​"get" id=​"3:​roster" xmlns=​"jabber:​client">​
<query xmlns=​"jabber:​iq:​roster">​</query>​
</iq>​
</body>​

----------------

<body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​
<iq xmlns=​"jabber:​client" from=​"admin.test@jabber.test.pl
<pawel.ochota@jabber.atsys.pl>" to=​"admin.test@jabber.test.pl/
<http://pawel.ochota@jabber.atsys.pl/>​204381162140958906999419"
id=​"3:​roster" type=​"result">​
<query xmlns=​"jabber:​iq:​roster">​
<item subscription=​"both" name=​"Test User1" jid=​"
test.user1@jabber.test.pl <katarzyna.budzisz@jabber.atsys.pl>">​…​</item>​
<item subscription=​"both" name=​"Test User2" jid=​"
test.user2@jabber.test.pl <aleksandra.budzisz@jabber.atsys.pl>">​…​</item>​
</query>​
</iq>​
</body>​

When I add these lines to initStatus in onConnected:

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

It's working after refresh, but not for the first time when user is opening
a browser. Maybe this is a problem with ejbabberd and RID, what do You
think?

Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-08-27 @ 10:17
Hi JC.

I'm using last version of converse (my custom build with little differences
like avatars). Well, my RID incrementation is in the server side, when I
increment RID in client side i've got 404 from the server and next request
is ok (new RID and SID from the server). When this request is good, I've
got output:

http://pastebin.com/zz6NRNK2

But after refresh I've got:

http://pastebin.com/TMi4LNuF

Maybe this is server side issue, what do you think? Are you using ejabberd
or Openfire when you are testing converse?

Re: [conversejs] Problem with contact list - everyone is offline

From:
Jc Brand
Date:
2014-08-27 @ 13:02
On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota wrote:
>    Hi JC.
>    I'm using last version of converse (my custom build with little
>    differences like avatars). Well, my RID incrementation is in the server
>    side, when I increment RID in client side i've got 404 from the server and
>    next request is ok (new RID and SID from the server). When this request is
>    good, I've got output:
>    [1]http://pastebin.com/zz6NRNK2

OK, looking at this output, I see that you do broadcast your presence, and then
you get the presences back from all your contacts.

>    But after refresh I've got: 
>    [2]http://pastebin.com/TMi4LNuF

In this case, you also broadcast your presence, but don't get your contact's
presences back. This is normal and expected (although it was the cause of the
problem discussed in the thread I linked to in my previous email).

>    Maybe this is server side issue, what do you think? Are you using ejabberd
>    or Openfire when you are testing converse?

I use ejabberd and prosody, but many other people use openfire.

You can try with a different XMPP server and see if the problem persists.

You can also step through the "presenceHandler" method in converse.js, to see what
happens there.

What should happen is that your contacts' chat statuses need to be updated
(according to their presence stanza's info).

After they are updated, the "onChange" method in RosterContactView will be
called to show the new status.

If this is a bug in converse.js, then the problem is likely somewhere in
either of those two methods.

Regards
JC

Re: [conversejs] Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-08-28 @ 09:33
Well, in presenceHandler everything it's ok, contacts have online statuses,
but onChange is not firing at all. Quite weird, i'm searching again.


2014-08-27 15:02 GMT+02:00 JC Brand <lists@opkode.com>:

> On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota wrote:
> >    Hi JC.
> >    I'm using last version of converse (my custom build with little
> >    differences like avatars). Well, my RID incrementation is in the
> server
> >    side, when I increment RID in client side i've got 404 from the
> server and
> >    next request is ok (new RID and SID from the server). When this
> request is
> >    good, I've got output:
> >    [1]http://pastebin.com/zz6NRNK2
>
> OK, looking at this output, I see that you do broadcast your presence, and
> then
> you get the presences back from all your contacts.
>
> >    But after refresh I've got:
> >    [2]http://pastebin.com/TMi4LNuF
>
> In this case, you also broadcast your presence, but don't get your
> contact's
> presences back. This is normal and expected (although it was the cause of
> the
> problem discussed in the thread I linked to in my previous email).
>
> >    Maybe this is server side issue, what do you think? Are you using
> ejabberd
> >    or Openfire when you are testing converse?
>
> I use ejabberd and prosody, but many other people use openfire.
>
> You can try with a different XMPP server and see if the problem persists.
>
> You can also step through the "presenceHandler" method in converse.js, to
> see what
> happens there.
>
> What should happen is that your contacts' chat statuses need to be updated
> (according to their presence stanza's info).
>
> After they are updated, the "onChange" method in RosterContactView will be
> called to show the new status.
>
> If this is a bug in converse.js, then the problem is likely somewhere in
> either of those two methods.
>
> Regards
> JC
>

Re: [conversejs] Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-08-28 @ 09:53
Ahhh, presenceHandler is invoking for all coctacts only first time, after
refresh is invoking only for me.


2014-08-28 11:33 GMT+02:00 Paweł Ochota <pawel.ochota@gmail.com>:

> Well, in presenceHandler everything it's ok, contacts have online
> statuses, but onChange is not firing at all. Quite weird, i'm searching
> again.
>
>
> 2014-08-27 15:02 GMT+02:00 JC Brand <lists@opkode.com>:
>
> On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota wrote:
>> >    Hi JC.
>> >    I'm using last version of converse (my custom build with little
>> >    differences like avatars). Well, my RID incrementation is in the
>> server
>> >    side, when I increment RID in client side i've got 404 from the
>> server and
>> >    next request is ok (new RID and SID from the server). When this
>> request is
>> >    good, I've got output:
>> >    [1]http://pastebin.com/zz6NRNK2
>>
>> OK, looking at this output, I see that you do broadcast your presence,
>> and then
>> you get the presences back from all your contacts.
>>
>> >    But after refresh I've got:
>> >    [2]http://pastebin.com/TMi4LNuF
>>
>> In this case, you also broadcast your presence, but don't get your
>> contact's
>> presences back. This is normal and expected (although it was the cause of
>> the
>> problem discussed in the thread I linked to in my previous email).
>>
>> >    Maybe this is server side issue, what do you think? Are you using
>> ejabberd
>> >    or Openfire when you are testing converse?
>>
>> I use ejabberd and prosody, but many other people use openfire.
>>
>> You can try with a different XMPP server and see if the problem persists.
>>
>> You can also step through the "presenceHandler" method in converse.js, to
>> see what
>> happens there.
>>
>> What should happen is that your contacts' chat statuses need to be updated
>> (according to their presence stanza's info).
>>
>> After they are updated, the "onChange" method in RosterContactView will be
>> called to show the new status.
>>
>> If this is a bug in converse.js, then the problem is likely somewhere in
>> either of those two methods.
>>
>> Regards
>> JC
>>
>
>

Re: [conversejs] Problem with contact list - everyone is offline

From:
Jc Brand
Date:
2014-08-28 @ 10:13
On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota wrote:
>    Ahhh, presenceHandler is invoking for all coctacts only first time, after
>    refresh is invoking only for me.

That's normal, because after reload you don't receive presences for all your
contacts again.

The reason for this is that they still think you are online and that there is
no need to re-send their presences to you.

The hack to send presence "unavailable" and then a normal presence again, is to
make them think you went away and are back now and therefore need to know
whether they are online or not.

However, from 0.8.x of converse.js, the presence statuses of contacts are
stored in sessionStorage, so you should not need to use the above mentioned
hack, because after page reload, users must have the same statuses (as fetched
from sessionStorage) as they had before the page reload.

What is unique to your problem, as far as I can tell, is that your contacts are
all offline from the very beginning, correct? In other words, their presences
never change from offline to anything else?

If presenceHandler appears to execute fine, then I would check here:
https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293

See if that event handler (which fires when a contact's chat status changes)
gets fired.

That event handler calls render() on the RosterContactView, which should then
update the UI to show the new status of the contact.

JC

 
>    2014-08-28 11:33 GMT+02:00 Paweł Ochota <[1]pawel.ochota@gmail.com>:
> 
>      Well, in presenceHandler everything it's ok, contacts have online
>      statuses, but onChange is not firing at all. Quite weird, i'm searching
>      again.
> 
>      2014-08-27 15:02 GMT+02:00 JC Brand <[2]lists@opkode.com>:
> 
>        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota wrote:
>        >    Hi JC.
>        >    I'm using last version of converse (my custom build with little
>        >    differences like avatars). Well, my RID incrementation is in the
>        server
>        >    side, when I increment RID in client side i've got 404 from the
>        server and
>        >    next request is ok (new RID and SID from the server). When this
>        request is
>        >    good, I've got output:
>        >    [1][3]http://pastebin.com/zz6NRNK2
> 
>        OK, looking at this output, I see that you do broadcast your presence,
>        and then
>        you get the presences back from all your contacts.
>        >    But after refresh I've got: 
>        >    [2][4]http://pastebin.com/TMi4LNuF
> 
>        In this case, you also broadcast your presence, but don't get your
>        contact's
>        presences back. This is normal and expected (although it was the cause
>        of the
>        problem discussed in the thread I linked to in my previous email).
>        >    Maybe this is server side issue, what do you think? Are you using
>        ejabberd
>        >    or Openfire when you are testing converse?
> 
>        I use ejabberd and prosody, but many other people use openfire.
> 
>        You can try with a different XMPP server and see if the problem
>        persists.
> 
>        You can also step through the "presenceHandler" method in converse.js,
>        to see what
>        happens there.
> 
>        What should happen is that your contacts' chat statuses need to be
>        updated
>        (according to their presence stanza's info).
> 
>        After they are updated, the "onChange" method in RosterContactView
>        will be
>        called to show the new status.
> 
>        If this is a bug in converse.js, then the problem is likely somewhere
>        in
>        either of those two methods.
> 
>        Regards
>        JC
> 
> References
> 
>    Visible links
>    1. mailto:pawel.ochota@gmail.com
>    2. mailto:lists@opkode.com
>    3. http://pastebin.com/zz6NRNK2
>    4. http://pastebin.com/TMi4LNuF

Re: [conversejs] Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-08-28 @ 11:00
> What is unique to your problem, as far as I can tell, is that your
contacts are
> all offline from the very beginning, correct? In other words, their
presences
> never change from offline to anything else?

Not exactly. I'm fighting with server side, because sometimes i've got 404
status and my roster is empty, but when I refresh the page I'm getting full
list with good statuses. But each next refresh causes problem with contacts
list, everyone is offline. Maybe this is problem with sessionStorage,
because when someone change their status then I can see him online, but
only when someone change status, not for the first time. So, in this line
https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293 everything
it's ok when status is change.


2014-08-28 12:13 GMT+02:00 JC Brand <lists@opkode.com>:

> On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota wrote:
> >    Ahhh, presenceHandler is invoking for all coctacts only first time,
> after
> >    refresh is invoking only for me.
>
> That's normal, because after reload you don't receive presences for all
> your
> contacts again.
>
> The reason for this is that they still think you are online and that there
> is
> no need to re-send their presences to you.
>
> The hack to send presence "unavailable" and then a normal presence again,
> is to
> make them think you went away and are back now and therefore need to know
> whether they are online or not.
>
> However, from 0.8.x of converse.js, the presence statuses of contacts are
> stored in sessionStorage, so you should not need to use the above mentioned
> hack, because after page reload, users must have the same statuses (as
> fetched
> from sessionStorage) as they had before the page reload.
>
> What is unique to your problem, as far as I can tell, is that your
> contacts are
> all offline from the very beginning, correct? In other words, their
> presences
> never change from offline to anything else?
>
> If presenceHandler appears to execute fine, then I would check here:
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>
> See if that event handler (which fires when a contact's chat status
> changes)
> gets fired.
>
> That event handler calls render() on the RosterContactView, which should
> then
> update the UI to show the new status of the contact.
>
> JC
>
>
> >    2014-08-28 11:33 GMT+02:00 Paweł Ochota <[1]pawel.ochota@gmail.com>:
> >
> >      Well, in presenceHandler everything it's ok, contacts have online
> >      statuses, but onChange is not firing at all. Quite weird, i'm
> searching
> >      again.
> >
> >      2014-08-27 15:02 GMT+02:00 JC Brand <[2]lists@opkode.com>:
> >
> >        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota wrote:
> >        >    Hi JC.
> >        >    I'm using last version of converse (my custom build with
> little
> >        >    differences like avatars). Well, my RID incrementation is in
> the
> >        server
> >        >    side, when I increment RID in client side i've got 404 from
> the
> >        server and
> >        >    next request is ok (new RID and SID from the server). When
> this
> >        request is
> >        >    good, I've got output:
> >        >    [1][3]http://pastebin.com/zz6NRNK2
> >
> >        OK, looking at this output, I see that you do broadcast your
> presence,
> >        and then
> >        you get the presences back from all your contacts.
> >        >    But after refresh I've got:
> >        >    [2][4]http://pastebin.com/TMi4LNuF
> >
> >        In this case, you also broadcast your presence, but don't get your
> >        contact's
> >        presences back. This is normal and expected (although it was the
> cause
> >        of the
> >        problem discussed in the thread I linked to in my previous email).
> >        >    Maybe this is server side issue, what do you think? Are you
> using
> >        ejabberd
> >        >    or Openfire when you are testing converse?
> >
> >        I use ejabberd and prosody, but many other people use openfire.
> >
> >        You can try with a different XMPP server and see if the problem
> >        persists.
> >
> >        You can also step through the "presenceHandler" method in
> converse.js,
> >        to see what
> >        happens there.
> >
> >        What should happen is that your contacts' chat statuses need to be
> >        updated
> >        (according to their presence stanza's info).
> >
> >        After they are updated, the "onChange" method in RosterContactView
> >        will be
> >        called to show the new status.
> >
> >        If this is a bug in converse.js, then the problem is likely
> somewhere
> >        in
> >        either of those two methods.
> >
> >        Regards
> >        JC
> >
> > References
> >
> >    Visible links
> >    1. mailto:pawel.ochota@gmail.com
> >    2. mailto:lists@opkode.com
> >    3. http://pastebin.com/zz6NRNK2
> >    4. http://pastebin.com/TMi4LNuF
>

Re: [conversejs] Problem with contact list - everyone is offline

From:
Jc Brand
Date:
2014-08-28 @ 16:03
On Thu, Aug 28, 2014 at 01:00:31PM +0200, Paweł Ochota wrote:
>    > What is unique to your problem, as far as I can tell, is that your
>    contacts are
>    > all offline from the very beginning, correct? In other words, their
>    presences
>    > never change from offline to anything else?
>    Not exactly. I'm fighting with server side, because sometimes i've got 404
>    status and my roster is empty, but when I refresh the page I'm getting
>    full list with good statuses. But each next refresh causes problem with
>    contacts list, everyone is offline. Maybe this is problem with
>    sessionStorage, because when someone change their status then I can see
>    him online, but only when someone change status, not for the first time.
>    So, in this
>    
line [1]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293 everything
>    it's ok when status is change.

You can double check whether the chat statuses are properly stored in
sessionStorage by putting a breakpoint here:

https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598

Then, call contact.get('chat_status') and see what you get. The status should
be the same as what the contact had on the previous page. Of course, you 
should only do this
once you've already have loaded the page at least once (with a full list with
good statuses).

If the contact on the previous page was "online" and is now "offline", then we
know the status wasn't properly saved to sessionStorage.



>    2014-08-28 12:13 GMT+02:00 JC Brand <[2]lists@opkode.com>:
> 
>      On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota wrote:
>      >    Ahhh, presenceHandler is invoking for all coctacts only first time,
>      after
>      >    refresh is invoking only for me.
> 
>      That's normal, because after reload you don't receive presences for all
>      your
>      contacts again.
> 
>      The reason for this is that they still think you are online and that
>      there is
>      no need to re-send their presences to you.
> 
>      The hack to send presence "unavailable" and then a normal presence
>      again, is to
>      make them think you went away and are back now and therefore need to
>      know
>      whether they are online or not.
> 
>      However, from 0.8.x of converse.js, the presence statuses of contacts
>      are
>      stored in sessionStorage, so you should not need to use the above
>      mentioned
>      hack, because after page reload, users must have the same statuses (as
>      fetched
>      from sessionStorage) as they had before the page reload.
> 
>      What is unique to your problem, as far as I can tell, is that your
>      contacts are
>      all offline from the very beginning, correct? In other words, their
>      presences
>      never change from offline to anything else?
> 
>      If presenceHandler appears to execute fine, then I would check here:
>      [3]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> 
>      See if that event handler (which fires when a contact's chat status
>      changes)
>      gets fired.
> 
>      That event handler calls render() on the RosterContactView, which should
>      then
>      update the UI to show the new status of the contact.
> 
>      JC
> 
>      >    2014-08-28 11:33 GMT+02:00 Paweł Ochota
>      <[1][4]pawel.ochota@gmail.com>:
>      >
>      >      Well, in presenceHandler everything it's ok, contacts have online
>      >      statuses, but onChange is not firing at all. Quite weird, i'm
>      searching
>      >      again.
>      >
>      >      2014-08-27 15:02 GMT+02:00 JC Brand <[2][5]lists@opkode.com>:
>      >
>      >        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota wrote:
>      >        >    Hi JC.
>      >        >    I'm using last version of converse (my custom build with
>      little
>      >        >    differences like avatars). Well, my RID incrementation is
>      in the
>      >        server
>      >        >    side, when I increment RID in client side i've got 404
>      from the
>      >        server and
>      >        >    next request is ok (new RID and SID from the server). When
>      this
>      >        request is
>      >        >    good, I've got output:
>      >        >    [1][3][6]http://pastebin.com/zz6NRNK2
>      >
>      >        OK, looking at this output, I see that you do broadcast your
>      presence,
>      >        and then
>      >        you get the presences back from all your contacts.
>      >        >    But after refresh I've got: 
>      >        >    [2][4][7]http://pastebin.com/TMi4LNuF
>      >
>      >        In this case, you also broadcast your presence, but don't get
>      your
>      >        contact's
>      >        presences back. This is normal and expected (although it was
>      the cause
>      >        of the
>      >        problem discussed in the thread I linked to in my previous
>      email).
>      >        >    Maybe this is server side issue, what do you think? Are
>      you using
>      >        ejabberd
>      >        >    or Openfire when you are testing converse?
>      >
>      >        I use ejabberd and prosody, but many other people use openfire.
>      >
>      >        You can try with a different XMPP server and see if the problem
>      >        persists.
>      >
>      >        You can also step through the "presenceHandler" method in
>      converse.js,
>      >        to see what
>      >        happens there.
>      >
>      >        What should happen is that your contacts' chat statuses need to
>      be
>      >        updated
>      >        (according to their presence stanza's info).
>      >
>      >        After they are updated, the "onChange" method in
>      RosterContactView
>      >        will be
>      >        called to show the new status.
>      >
>      >        If this is a bug in converse.js, then the problem is likely
>      somewhere
>      >        in
>      >        either of those two methods.
>      >
>      >        Regards
>      >        JC
>      >
>      > References
>      >
>      >    Visible links
>      >    1. mailto:[8]pawel.ochota@gmail.com
>      >    2. mailto:[9]lists@opkode.com
>      >    3. [10]http://pastebin.com/zz6NRNK2
>      >    4. [11]http://pastebin.com/TMi4LNuF
> 
> References
> 
>    Visible links
>    1. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>    2. mailto:lists@opkode.com
>    3. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>    4. mailto:pawel.ochota@gmail.com
>    5. mailto:lists@opkode.com
>    6. http://pastebin.com/zz6NRNK2
>    7. http://pastebin.com/TMi4LNuF
>    8. mailto:pawel.ochota@gmail.com
>    9. mailto:lists@opkode.com
>   10. http://pastebin.com/zz6NRNK2
>   11. http://pastebin.com/TMi4LNuF

Re: [conversejs] Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-09-01 @ 09:43
hi JC

"If the contact on the previous page was "online" and is now "offline",
then we
know the status wasn't properly saved to sessionStorage."

And this is it. Everyone has offline status, but in previous page some
people have online status.


2014-08-28 18:03 GMT+02:00 JC Brand <lists@opkode.com>:

> On Thu, Aug 28, 2014 at 01:00:31PM +0200, Paweł Ochota wrote:
> >    > What is unique to your problem, as far as I can tell, is that your
> >    contacts are
> >    > all offline from the very beginning, correct? In other words, their
> >    presences
> >    > never change from offline to anything else?
> >    Not exactly. I'm fighting with server side, because sometimes i've
> got 404
> >    status and my roster is empty, but when I refresh the page I'm getting
> >    full list with good statuses. But each next refresh causes problem
> with
> >    contacts list, everyone is offline. Maybe this is problem with
> >    sessionStorage, because when someone change their status then I can
> see
> >    him online, but only when someone change status, not for the first
> time.
> >    So, in this
> >    line [1]
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>  everything
> >    it's ok when status is change.
>
> You can double check whether the chat statuses are properly stored in
> sessionStorage by putting a breakpoint here:
>
> https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
>
> Then, call contact.get('chat_status') and see what you get. The status
> should
> be the same as what the contact had on the previous page. Of course, you
> should only do this
> once you've already have loaded the page at least once (with a full list
> with
> good statuses).
>
> If the contact on the previous page was "online" and is now "offline",
> then we
> know the status wasn't properly saved to sessionStorage.
>
>
>
> >    2014-08-28 12:13 GMT+02:00 JC Brand <[2]lists@opkode.com>:
> >
> >      On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota wrote:
> >      >    Ahhh, presenceHandler is invoking for all coctacts only first
> time,
> >      after
> >      >    refresh is invoking only for me.
> >
> >      That's normal, because after reload you don't receive presences for
> all
> >      your
> >      contacts again.
> >
> >      The reason for this is that they still think you are online and that
> >      there is
> >      no need to re-send their presences to you.
> >
> >      The hack to send presence "unavailable" and then a normal presence
> >      again, is to
> >      make them think you went away and are back now and therefore need to
> >      know
> >      whether they are online or not.
> >
> >      However, from 0.8.x of converse.js, the presence statuses of
> contacts
> >      are
> >      stored in sessionStorage, so you should not need to use the above
> >      mentioned
> >      hack, because after page reload, users must have the same statuses
> (as
> >      fetched
> >      from sessionStorage) as they had before the page reload.
> >
> >      What is unique to your problem, as far as I can tell, is that your
> >      contacts are
> >      all offline from the very beginning, correct? In other words, their
> >      presences
> >      never change from offline to anything else?
> >
> >      If presenceHandler appears to execute fine, then I would check here:
> >      [3]
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >
> >      See if that event handler (which fires when a contact's chat status
> >      changes)
> >      gets fired.
> >
> >      That event handler calls render() on the RosterContactView, which
> should
> >      then
> >      update the UI to show the new status of the contact.
> >
> >      JC
> >
> >      >    2014-08-28 11:33 GMT+02:00 Paweł Ochota
> >      <[1][4]pawel.ochota@gmail.com>:
> >      >
> >      >      Well, in presenceHandler everything it's ok, contacts have
> online
> >      >      statuses, but onChange is not firing at all. Quite weird, i'm
> >      searching
> >      >      again.
> >      >
> >      >      2014-08-27 15:02 GMT+02:00 JC Brand <[2][5]lists@opkode.com
> >:
> >      >
> >      >        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota
> wrote:
> >      >        >    Hi JC.
> >      >        >    I'm using last version of converse (my custom build
> with
> >      little
> >      >        >    differences like avatars). Well, my RID
> incrementation is
> >      in the
> >      >        server
> >      >        >    side, when I increment RID in client side i've got 404
> >      from the
> >      >        server and
> >      >        >    next request is ok (new RID and SID from the server).
> When
> >      this
> >      >        request is
> >      >        >    good, I've got output:
> >      >        >    [1][3][6]http://pastebin.com/zz6NRNK2
> >      >
> >      >        OK, looking at this output, I see that you do broadcast
> your
> >      presence,
> >      >        and then
> >      >        you get the presences back from all your contacts.
> >      >        >    But after refresh I've got:
> >      >        >    [2][4][7]http://pastebin.com/TMi4LNuF
> >      >
> >      >        In this case, you also broadcast your presence, but don't
> get
> >      your
> >      >        contact's
> >      >        presences back. This is normal and expected (although it
> was
> >      the cause
> >      >        of the
> >      >        problem discussed in the thread I linked to in my previous
> >      email).
> >      >        >    Maybe this is server side issue, what do you think?
> Are
> >      you using
> >      >        ejabberd
> >      >        >    or Openfire when you are testing converse?
> >      >
> >      >        I use ejabberd and prosody, but many other people use
> openfire.
> >      >
> >      >        You can try with a different XMPP server and see if the
> problem
> >      >        persists.
> >      >
> >      >        You can also step through the "presenceHandler" method in
> >      converse.js,
> >      >        to see what
> >      >        happens there.
> >      >
> >      >        What should happen is that your contacts' chat statuses
> need to
> >      be
> >      >        updated
> >      >        (according to their presence stanza's info).
> >      >
> >      >        After they are updated, the "onChange" method in
> >      RosterContactView
> >      >        will be
> >      >        called to show the new status.
> >      >
> >      >        If this is a bug in converse.js, then the problem is likely
> >      somewhere
> >      >        in
> >      >        either of those two methods.
> >      >
> >      >        Regards
> >      >        JC
> >      >
> >      > References
> >      >
> >      >    Visible links
> >      >    1. mailto:[8]pawel.ochota@gmail.com
> >      >    2. mailto:[9]lists@opkode.com
> >      >    3. [10]http://pastebin.com/zz6NRNK2
> >      >    4. [11]http://pastebin.com/TMi4LNuF
> >
> > References
> >
> >    Visible links
> >    1.
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >    2. mailto:lists@opkode.com
> >    3.
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >    4. mailto:pawel.ochota@gmail.com
> >    5. mailto:lists@opkode.com
> >    6. http://pastebin.com/zz6NRNK2
> >    7. http://pastebin.com/TMi4LNuF
> >    8. mailto:pawel.ochota@gmail.com
> >    9. mailto:lists@opkode.com
> >   10. http://pastebin.com/zz6NRNK2
> >   11. http://pastebin.com/TMi4LNuF
>

Re: [conversejs] Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-09-01 @ 10:18
Ok I made some changes, but i'm not sure it's the right way to fix this
"bug":

this.RosterContact = Backbone.Model.extend({
            initialize: function (attributes, options) {
                var jid = attributes.jid;
                if (!attributes.fullname) {
                    attributes.fullname = jid;
                }
                if (!attributes.chat_status) {                // <-- My
change
                    attributes.chat_status = 'offline';    // <-- My change
                }
                var attrs = _.extend({
                    'id': jid,
                    'user_id': Strophe.getNodeFromJid(jid),
                    'resources': [],
                    'groups': [],
                    'status': ''
                }, attributes);
                this.set(attrs);
            }
        });

Second change (RosterGroupView):

initialize: function () {
                this.model.contacts.on("add", this.addContact, this);
                this.model.contacts.on("change:chat_status", function
(contact) {
                    // This might be optimized by instead of first sorting,
finding the correct position in positionContact
                    var contact_temp =
this.model.contacts.get(Strophe.getBareJidFromJid(contact.get('jid')));
  // <--- My change
                    contact_temp.save({'chat_status':
contact.get('chat_status')});
      // <--- My change
                    this.model.contacts.sort();
                    this.positionContact(contact).render();
                }, this);
                this.model.contacts.on("destroy", this.onRemove, this);
                this.model.contacts.on("remove", this.onRemove, this);
                converse.roster.on('change:groups',
this.onContactGroupChange, this);
            }

For now it's working, but i'm not sure it's a good way.


2014-09-01 11:43 GMT+02:00 Paweł Ochota <pawel.ochota@gmail.com>:

> hi JC
>
> "If the contact on the previous page was "online" and is now "offline",
> then we
> know the status wasn't properly saved to sessionStorage."
>
> And this is it. Everyone has offline status, but in previous page some
> people have online status.
>
>
> 2014-08-28 18:03 GMT+02:00 JC Brand <lists@opkode.com>:
>
> On Thu, Aug 28, 2014 at 01:00:31PM +0200, Paweł Ochota wrote:
>> >    > What is unique to your problem, as far as I can tell, is that your
>> >    contacts are
>> >    > all offline from the very beginning, correct? In other words, their
>> >    presences
>> >    > never change from offline to anything else?
>> >    Not exactly. I'm fighting with server side, because sometimes i've
>> got 404
>> >    status and my roster is empty, but when I refresh the page I'm
>> getting
>> >    full list with good statuses. But each next refresh causes problem
>> with
>> >    contacts list, everyone is offline. Maybe this is problem with
>> >    sessionStorage, because when someone change their status then I can
>> see
>> >    him online, but only when someone change status, not for the first
>> time.
>> >    So, in this
>> >    line [1]
>> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>>  everything
>> >    it's ok when status is change.
>>
>> You can double check whether the chat statuses are properly stored in
>> sessionStorage by putting a breakpoint here:
>>
>> https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
>>
>> Then, call contact.get('chat_status') and see what you get. The status
>> should
>> be the same as what the contact had on the previous page. Of course, you
>> should only do this
>> once you've already have loaded the page at least once (with a full list
>> with
>> good statuses).
>>
>> If the contact on the previous page was "online" and is now "offline",
>> then we
>> know the status wasn't properly saved to sessionStorage.
>>
>>
>>
>> >    2014-08-28 12:13 GMT+02:00 JC Brand <[2]lists@opkode.com>:
>> >
>> >      On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota wrote:
>> >      >    Ahhh, presenceHandler is invoking for all coctacts only first
>> time,
>> >      after
>> >      >    refresh is invoking only for me.
>> >
>> >      That's normal, because after reload you don't receive presences
>> for all
>> >      your
>> >      contacts again.
>> >
>> >      The reason for this is that they still think you are online and
>> that
>> >      there is
>> >      no need to re-send their presences to you.
>> >
>> >      The hack to send presence "unavailable" and then a normal presence
>> >      again, is to
>> >      make them think you went away and are back now and therefore need
>> to
>> >      know
>> >      whether they are online or not.
>> >
>> >      However, from 0.8.x of converse.js, the presence statuses of
>> contacts
>> >      are
>> >      stored in sessionStorage, so you should not need to use the above
>> >      mentioned
>> >      hack, because after page reload, users must have the same statuses
>> (as
>> >      fetched
>> >      from sessionStorage) as they had before the page reload.
>> >
>> >      What is unique to your problem, as far as I can tell, is that your
>> >      contacts are
>> >      all offline from the very beginning, correct? In other words, their
>> >      presences
>> >      never change from offline to anything else?
>> >
>> >      If presenceHandler appears to execute fine, then I would check
>> here:
>> >      [3]
>> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>> >
>> >      See if that event handler (which fires when a contact's chat status
>> >      changes)
>> >      gets fired.
>> >
>> >      That event handler calls render() on the RosterContactView, which
>> should
>> >      then
>> >      update the UI to show the new status of the contact.
>> >
>> >      JC
>> >
>> >      >    2014-08-28 11:33 GMT+02:00 Paweł Ochota
>> >      <[1][4]pawel.ochota@gmail.com>:
>> >      >
>> >      >      Well, in presenceHandler everything it's ok, contacts have
>> online
>> >      >      statuses, but onChange is not firing at all. Quite weird,
>> i'm
>> >      searching
>> >      >      again.
>> >      >
>> >      >      2014-08-27 15:02 GMT+02:00 JC Brand <[2][5]lists@opkode.com
>> >:
>> >      >
>> >      >        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota
>> wrote:
>> >      >        >    Hi JC.
>> >      >        >    I'm using last version of converse (my custom build
>> with
>> >      little
>> >      >        >    differences like avatars). Well, my RID
>> incrementation is
>> >      in the
>> >      >        server
>> >      >        >    side, when I increment RID in client side i've got
>> 404
>> >      from the
>> >      >        server and
>> >      >        >    next request is ok (new RID and SID from the
>> server). When
>> >      this
>> >      >        request is
>> >      >        >    good, I've got output:
>> >      >        >    [1][3][6]http://pastebin.com/zz6NRNK2
>> >      >
>> >      >        OK, looking at this output, I see that you do broadcast
>> your
>> >      presence,
>> >      >        and then
>> >      >        you get the presences back from all your contacts.
>> >      >        >    But after refresh I've got:
>> >      >        >    [2][4][7]http://pastebin.com/TMi4LNuF
>> >      >
>> >      >        In this case, you also broadcast your presence, but don't
>> get
>> >      your
>> >      >        contact's
>> >      >        presences back. This is normal and expected (although it
>> was
>> >      the cause
>> >      >        of the
>> >      >        problem discussed in the thread I linked to in my previous
>> >      email).
>> >      >        >    Maybe this is server side issue, what do you think?
>> Are
>> >      you using
>> >      >        ejabberd
>> >      >        >    or Openfire when you are testing converse?
>> >      >
>> >      >        I use ejabberd and prosody, but many other people use
>> openfire.
>> >      >
>> >      >        You can try with a different XMPP server and see if the
>> problem
>> >      >        persists.
>> >      >
>> >      >        You can also step through the "presenceHandler" method in
>> >      converse.js,
>> >      >        to see what
>> >      >        happens there.
>> >      >
>> >      >        What should happen is that your contacts' chat statuses
>> need to
>> >      be
>> >      >        updated
>> >      >        (according to their presence stanza's info).
>> >      >
>> >      >        After they are updated, the "onChange" method in
>> >      RosterContactView
>> >      >        will be
>> >      >        called to show the new status.
>> >      >
>> >      >        If this is a bug in converse.js, then the problem is
>> likely
>> >      somewhere
>> >      >        in
>> >      >        either of those two methods.
>> >      >
>> >      >        Regards
>> >      >        JC
>> >      >
>> >      > References
>> >      >
>> >      >    Visible links
>> >      >    1. mailto:[8]pawel.ochota@gmail.com
>> >      >    2. mailto:[9]lists@opkode.com
>> >      >    3. [10]http://pastebin.com/zz6NRNK2
>> >      >    4. [11]http://pastebin.com/TMi4LNuF
>> >
>> > References
>> >
>> >    Visible links
>> >    1.
>> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>> >    2. mailto:lists@opkode.com
>> >    3.
>> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>> >    4. mailto:pawel.ochota@gmail.com
>> >    5. mailto:lists@opkode.com
>> >    6. http://pastebin.com/zz6NRNK2
>> >    7. http://pastebin.com/TMi4LNuF
>> >    8. mailto:pawel.ochota@gmail.com
>> >    9. mailto:lists@opkode.com
>> >   10. http://pastebin.com/zz6NRNK2
>> >   11. http://pastebin.com/TMi4LNuF
>>
>
>

Re: [conversejs] Problem with contact list - everyone is offline

From:
Jc Brand
Date:
2014-09-02 @ 14:46
Hi Paweł

I've found and fixed the bug.

https://github.com/jcbrand/converse.js/commit/14ce4a0e6d5b8a5f2c4e949f5f602fdfd73d9bc8

The problem was that the chat_status retrieved from sessionStorage was being
overridden with 'offline' as soon as the RosterContact was created :0/

Can you please double check?

Thanks
JC

On Mon, Sep 01, 2014 at 12:18:42PM +0200, Paweł Ochota wrote:
>    Ok I made some changes, but i'm not sure it's the right way to fix this
>    "bug":
>    this.RosterContact = Backbone.Model.extend({
>                initialize: function (attributes, options) {
>                    var jid = attributes.jid;
>                    if (!attributes.fullname) {
>                        attributes.fullname = jid;
>                    }
>                    if (!attributes.chat_status) {                // <-- 
My change
>                        attributes.chat_status = 'offline';    // <-- My change
>                    }
>                    var attrs = _.extend({
>                        'id': jid,
>                        'user_id': Strophe.getNodeFromJid(jid),
>                        'resources': [],
>                        'groups': [],
>                        'status': ''
>                    }, attributes);
>                    this.set(attrs);
>                }
>            });

>    Second change (RosterGroupView):
>    initialize: function () {
>                    this.model.contacts.on("add", this.addContact, this);
>                    this.model.contacts.on("change:chat_status", function
(contact) {
>                        // This might be optimized by instead of first 
sorting, finding the correct position in positionContact
>                        var contact_temp = 
this.model.contacts.get(Strophe.getBareJidFromJid(contact.get('jid'))); 
 // <--- My change
>                        contact_temp.save({'chat_status': 
contact.get('chat_status')});  // <--- My change
>                        this.model.contacts.sort();
>                        this.positionContact(contact).render();
>                    }, this);
>                    this.model.contacts.on("destroy", this.onRemove, this);
>                    this.model.contacts.on("remove", this.onRemove, this);
>                    converse.roster.on('change:groups', 
this.onContactGroupChange, this);
>                }
>    For now it's working, but i'm not sure it's a good way.
> 
>    2014-09-01 11:43 GMT+02:00 Paweł Ochota <[1]pawel.ochota@gmail.com>:
> 
>      hi JC
>      "If the contact on the previous page was "online" and is now "offline",
>      then we
>      know the status wasn't properly saved to sessionStorage."
>      And this is it. Everyone has offline status, but in previous page some
>      people have online status.
> 
>      2014-08-28 18:03 GMT+02:00 JC Brand <[2]lists@opkode.com>:
> 
>        On Thu, Aug 28, 2014 at 01:00:31PM +0200, Paweł Ochota wrote:
>        >    > What is unique to your problem, as far as I can tell, is that
>        your
>        >    contacts are
>        >    > all offline from the very beginning, correct? In other words,
>        their
>        >    presences
>        >    > never change from offline to anything else?
>        >    Not exactly. I'm fighting with server side, because sometimes
>        i've got 404
>        >    status and my roster is empty, but when I refresh the page I'm
>        getting
>        >    full list with good statuses. But each next refresh causes
>        problem with
>        >    contacts list, everyone is offline. Maybe this is problem with
>        >    sessionStorage, because when someone change their status then I
>        can see
>        >    him online, but only when someone change status, not for the
>        first time.
>        >    So, in this
>        >   
>        
line [1][3]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293 everything
>        >    it's ok when status is change.
> 
>        You can double check whether the chat statuses are properly stored in
>        sessionStorage by putting a breakpoint here:
> 
>        [4]https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
> 
>        Then, call contact.get('chat_status') and see what you get. The status
>        should
>        be the same as what the contact had on the previous page. Of course,
>        you should only do this
>        once you've already have loaded the page at least once (with a full
>        list with
>        good statuses).
> 
>        If the contact on the previous page was "online" and is now "offline",
>        then we
>        know the status wasn't properly saved to sessionStorage.
> 
>        >    2014-08-28 12:13 GMT+02:00 JC Brand <[2][5]lists@opkode.com>:
>        >
>        >      On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota wrote:
>        >      >    Ahhh, presenceHandler is invoking for all coctacts only
>        first time,
>        >      after
>        >      >    refresh is invoking only for me.
>        >
>        >      That's normal, because after reload you don't receive presences
>        for all
>        >      your
>        >      contacts again.
>        >
>        >      The reason for this is that they still think you are online and
>        that
>        >      there is
>        >      no need to re-send their presences to you.
>        >
>        >      The hack to send presence "unavailable" and then a normal
>        presence
>        >      again, is to
>        >      make them think you went away and are back now and therefore
>        need to
>        >      know
>        >      whether they are online or not.
>        >
>        >      However, from 0.8.x of converse.js, the presence statuses of
>        contacts
>        >      are
>        >      stored in sessionStorage, so you should not need to use the
>        above
>        >      mentioned
>        >      hack, because after page reload, users must have the same
>        statuses (as
>        >      fetched
>        >      from sessionStorage) as they had before the page reload.
>        >
>        >      What is unique to your problem, as far as I can tell, is that
>        your
>        >      contacts are
>        >      all offline from the very beginning, correct? In other words,
>        their
>        >      presences
>        >      never change from offline to anything else?
>        >
>        >      If presenceHandler appears to execute fine, then I would check
>        here:
>        >     
>        
[3][6]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>        >
>        >      See if that event handler (which fires when a contact's chat
>        status
>        >      changes)
>        >      gets fired.
>        >
>        >      That event handler calls render() on the RosterContactView,
>        which should
>        >      then
>        >      update the UI to show the new status of the contact.
>        >
>        >      JC
>        >
>        >      >    2014-08-28 11:33 GMT+02:00 Paweł Ochota
>        >      <[1][4][7]pawel.ochota@gmail.com>:
>        >      >
>        >      >      Well, in presenceHandler everything it's ok, contacts
>        have online
>        >      >      statuses, but onChange is not firing at all. Quite
>        weird, i'm
>        >      searching
>        >      >      again.
>        >      >
>        >      >      2014-08-27 15:02 GMT+02:00 JC Brand
>        <[2][5][8]lists@opkode.com>:
>        >      >
>        >      >        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł Ochota
>        wrote:
>        >      >        >    Hi JC.
>        >      >        >    I'm using last version of converse (my custom
>        build with
>        >      little
>        >      >        >    differences like avatars). Well, my RID
>        incrementation is
>        >      in the
>        >      >        server
>        >      >        >    side, when I increment RID in client side i've
>        got 404
>        >      from the
>        >      >        server and
>        >      >        >    next request is ok (new RID and SID from the
>        server). When
>        >      this
>        >      >        request is
>        >      >        >    good, I've got output:
>        >      >        >    [1][3][6][9]http://pastebin.com/zz6NRNK2
>        >      >
>        >      >        OK, looking at this output, I see that you do
>        broadcast your
>        >      presence,
>        >      >        and then
>        >      >        you get the presences back from all your contacts.
>        >      >        >    But after refresh I've got: 
>        >      >        >    [2][4][7][10]http://pastebin.com/TMi4LNuF
>        >      >
>        >      >        In this case, you also broadcast your presence, but
>        don't get
>        >      your
>        >      >        contact's
>        >      >        presences back. This is normal and expected (although
>        it was
>        >      the cause
>        >      >        of the
>        >      >        problem discussed in the thread I linked to in my
>        previous
>        >      email).
>        >      >        >    Maybe this is server side issue, what do you
>        think? Are
>        >      you using
>        >      >        ejabberd
>        >      >        >    or Openfire when you are testing converse?
>        >      >
>        >      >        I use ejabberd and prosody, but many other people use
>        openfire.
>        >      >
>        >      >        You can try with a different XMPP server and see if
>        the problem
>        >      >        persists.
>        >      >
>        >      >        You can also step through the "presenceHandler" method
>        in
>        >      converse.js,
>        >      >        to see what
>        >      >        happens there.
>        >      >
>        >      >        What should happen is that your contacts' chat
>        statuses need to
>        >      be
>        >      >        updated
>        >      >        (according to their presence stanza's info).
>        >      >
>        >      >        After they are updated, the "onChange" method in
>        >      RosterContactView
>        >      >        will be
>        >      >        called to show the new status.
>        >      >
>        >      >        If this is a bug in converse.js, then the problem is
>        likely
>        >      somewhere
>        >      >        in
>        >      >        either of those two methods.
>        >      >
>        >      >        Regards
>        >      >        JC
>        >      >
>        >      > References
>        >      >
>        >      >    Visible links
>        >      >    1. mailto:[8][11]pawel.ochota@gmail.com
>        >      >    2. mailto:[9][12]lists@opkode.com
>        >      >    3. [10][13]http://pastebin.com/zz6NRNK2
>        >      >    4. [11][14]http://pastebin.com/TMi4LNuF
>        >
>        > References
>        >
>        >    Visible links
>        >    1.
>        [15]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>        >    2. mailto:[16]lists@opkode.com
>        >    3.
>        [17]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>        >    4. mailto:[18]pawel.ochota@gmail.com
>        >    5. mailto:[19]lists@opkode.com
>        >    6. [20]http://pastebin.com/zz6NRNK2
>        >    7. [21]http://pastebin.com/TMi4LNuF
>        >    8. mailto:[22]pawel.ochota@gmail.com
>        >    9. mailto:[23]lists@opkode.com
>        >   10. [24]http://pastebin.com/zz6NRNK2
>        >   11. [25]http://pastebin.com/TMi4LNuF
> 
> References
> 
>    Visible links
>    1. mailto:pawel.ochota@gmail.com
>    2. mailto:lists@opkode.com
>    3. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>    4. https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
>    5. mailto:lists@opkode.com
>    6. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>    7. mailto:pawel.ochota@gmail.com
>    8. mailto:lists@opkode.com
>    9. http://pastebin.com/zz6NRNK2
>   10. http://pastebin.com/TMi4LNuF
>   11. mailto:pawel.ochota@gmail.com
>   12. mailto:lists@opkode.com
>   13. http://pastebin.com/zz6NRNK2
>   14. http://pastebin.com/TMi4LNuF
>   15. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   16. mailto:lists@opkode.com
>   17. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   18. mailto:pawel.ochota@gmail.com
>   19. mailto:lists@opkode.com
>   20. http://pastebin.com/zz6NRNK2
>   21. http://pastebin.com/TMi4LNuF
>   22. mailto:pawel.ochota@gmail.com
>   23. mailto:lists@opkode.com
>   24. http://pastebin.com/zz6NRNK2
>   25. http://pastebin.com/TMi4LNuF

Re: [conversejs] Problem with contact list - everyone is offline

From:
Paweł Ochota
Date:
2014-09-03 @ 06:13
hi JC,

Everything is ok now, thank You very much for your help :) Converse.js
becomes most advance and best solution for web chat :) Greetings!


2014-09-02 16:46 GMT+02:00 JC Brand <lists@opkode.com>:

> Hi Paweł
>
> I've found and fixed the bug.
>
> 
https://github.com/jcbrand/converse.js/commit/14ce4a0e6d5b8a5f2c4e949f5f602fdfd73d9bc8
>
> The problem was that the chat_status retrieved from sessionStorage was
> being
> overridden with 'offline' as soon as the RosterContact was created :0/
>
> Can you please double check?
>
> Thanks
> JC
>
> On Mon, Sep 01, 2014 at 12:18:42PM +0200, Paweł Ochota wrote:
> >    Ok I made some changes, but i'm not sure it's the right way to fix
> this
> >    "bug":
> >    this.RosterContact = Backbone.Model.extend({
> >                initialize: function (attributes, options) {
> >                    var jid = attributes.jid;
> >                    if (!attributes.fullname) {
> >                        attributes.fullname = jid;
> >                    }
> >                    if (!attributes.chat_status) {                // <--
> My change
> >                        attributes.chat_status = 'offline';    // <-- My
> change
> >                    }
> >                    var attrs = _.extend({
> >                        'id': jid,
> >                        'user_id': Strophe.getNodeFromJid(jid),
> >                        'resources': [],
> >                        'groups': [],
> >                        'status': ''
> >                    }, attributes);
> >                    this.set(attrs);
> >                }
> >            });
>
> >    Second change (RosterGroupView):
> >    initialize: function () {
> >                    this.model.contacts.on("add", this.addContact, this);
> >                    this.model.contacts.on("change:chat_status", function
> (contact) {
> >                        // This might be optimized by instead of first
> sorting, finding the correct position in positionContact
> >                        var contact_temp =
> this.model.contacts.get(Strophe.getBareJidFromJid(contact.get('jid')));  //
> <--- My change
> >                        contact_temp.save({'chat_status':
> contact.get('chat_status')});  // <--- My change
> >                        this.model.contacts.sort();
> >                        this.positionContact(contact).render();
> >                    }, this);
> >                    this.model.contacts.on("destroy", this.onRemove,
> this);
> >                    this.model.contacts.on("remove", this.onRemove, this);
> >                    converse.roster.on('change:groups',
> this.onContactGroupChange, this);
> >                }
> >    For now it's working, but i'm not sure it's a good way.
> >
> >    2014-09-01 11:43 GMT+02:00 Paweł Ochota <[1]pawel.ochota@gmail.com>:
> >
> >      hi JC
> >      "If the contact on the previous page was "online" and is now
> "offline",
> >      then we
> >      know the status wasn't properly saved to sessionStorage."
> >      And this is it. Everyone has offline status, but in previous page
> some
> >      people have online status.
> >
> >      2014-08-28 18:03 GMT+02:00 JC Brand <[2]lists@opkode.com>:
> >
> >        On Thu, Aug 28, 2014 at 01:00:31PM +0200, Paweł Ochota wrote:
> >        >    > What is unique to your problem, as far as I can tell, is
> that
> >        your
> >        >    contacts are
> >        >    > all offline from the very beginning, correct? In other
> words,
> >        their
> >        >    presences
> >        >    > never change from offline to anything else?
> >        >    Not exactly. I'm fighting with server side, because sometimes
> >        i've got 404
> >        >    status and my roster is empty, but when I refresh the page
> I'm
> >        getting
> >        >    full list with good statuses. But each next refresh causes
> >        problem with
> >        >    contacts list, everyone is offline. Maybe this is problem
> with
> >        >    sessionStorage, because when someone change their status
> then I
> >        can see
> >        >    him online, but only when someone change status, not for the
> >        first time.
> >        >    So, in this
> >        >
> >        line [1][3]
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>  everything
> >        >    it's ok when status is change.
> >
> >        You can double check whether the chat statuses are properly
> stored in
> >        sessionStorage by putting a breakpoint here:
> >
> >        [4]
> https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
> >
> >        Then, call contact.get('chat_status') and see what you get. The
> status
> >        should
> >        be the same as what the contact had on the previous page. Of
> course,
> >        you should only do this
> >        once you've already have loaded the page at least once (with a
> full
> >        list with
> >        good statuses).
> >
> >        If the contact on the previous page was "online" and is now
> "offline",
> >        then we
> >        know the status wasn't properly saved to sessionStorage.
> >
> >        >    2014-08-28 12:13 GMT+02:00 JC Brand <[2][5]lists@opkode.com
> >:
> >        >
> >        >      On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota
> wrote:
> >        >      >    Ahhh, presenceHandler is invoking for all coctacts
> only
> >        first time,
> >        >      after
> >        >      >    refresh is invoking only for me.
> >        >
> >        >      That's normal, because after reload you don't receive
> presences
> >        for all
> >        >      your
> >        >      contacts again.
> >        >
> >        >      The reason for this is that they still think you are
> online and
> >        that
> >        >      there is
> >        >      no need to re-send their presences to you.
> >        >
> >        >      The hack to send presence "unavailable" and then a normal
> >        presence
> >        >      again, is to
> >        >      make them think you went away and are back now and
> therefore
> >        need to
> >        >      know
> >        >      whether they are online or not.
> >        >
> >        >      However, from 0.8.x of converse.js, the presence statuses
> of
> >        contacts
> >        >      are
> >        >      stored in sessionStorage, so you should not need to use the
> >        above
> >        >      mentioned
> >        >      hack, because after page reload, users must have the same
> >        statuses (as
> >        >      fetched
> >        >      from sessionStorage) as they had before the page reload.
> >        >
> >        >      What is unique to your problem, as far as I can tell, is
> that
> >        your
> >        >      contacts are
> >        >      all offline from the very beginning, correct? In other
> words,
> >        their
> >        >      presences
> >        >      never change from offline to anything else?
> >        >
> >        >      If presenceHandler appears to execute fine, then I would
> check
> >        here:
> >        >
> >        [3][6]
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >        >
> >        >      See if that event handler (which fires when a contact's
> chat
> >        status
> >        >      changes)
> >        >      gets fired.
> >        >
> >        >      That event handler calls render() on the RosterContactView,
> >        which should
> >        >      then
> >        >      update the UI to show the new status of the contact.
> >        >
> >        >      JC
> >        >
> >        >      >    2014-08-28 11:33 GMT+02:00 Paweł Ochota
> >        >      <[1][4][7]pawel.ochota@gmail.com>:
> >        >      >
> >        >      >      Well, in presenceHandler everything it's ok,
> contacts
> >        have online
> >        >      >      statuses, but onChange is not firing at all. Quite
> >        weird, i'm
> >        >      searching
> >        >      >      again.
> >        >      >
> >        >      >      2014-08-27 15:02 GMT+02:00 JC Brand
> >        <[2][5][8]lists@opkode.com>:
> >        >      >
> >        >      >        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł
> Ochota
> >        wrote:
> >        >      >        >    Hi JC.
> >        >      >        >    I'm using last version of converse (my custom
> >        build with
> >        >      little
> >        >      >        >    differences like avatars). Well, my RID
> >        incrementation is
> >        >      in the
> >        >      >        server
> >        >      >        >    side, when I increment RID in client side
> i've
> >        got 404
> >        >      from the
> >        >      >        server and
> >        >      >        >    next request is ok (new RID and SID from the
> >        server). When
> >        >      this
> >        >      >        request is
> >        >      >        >    good, I've got output:
> >        >      >        >    [1][3][6][9]http://pastebin.com/zz6NRNK2
> >        >      >
> >        >      >        OK, looking at this output, I see that you do
> >        broadcast your
> >        >      presence,
> >        >      >        and then
> >        >      >        you get the presences back from all your contacts.
> >        >      >        >    But after refresh I've got:
> >        >      >        >    [2][4][7][10]http://pastebin.com/TMi4LNuF
> >        >      >
> >        >      >        In this case, you also broadcast your presence,
> but
> >        don't get
> >        >      your
> >        >      >        contact's
> >        >      >        presences back. This is normal and expected
> (although
> >        it was
> >        >      the cause
> >        >      >        of the
> >        >      >        problem discussed in the thread I linked to in my
> >        previous
> >        >      email).
> >        >      >        >    Maybe this is server side issue, what do you
> >        think? Are
> >        >      you using
> >        >      >        ejabberd
> >        >      >        >    or Openfire when you are testing converse?
> >        >      >
> >        >      >        I use ejabberd and prosody, but many other people
> use
> >        openfire.
> >        >      >
> >        >      >        You can try with a different XMPP server and see
> if
> >        the problem
> >        >      >        persists.
> >        >      >
> >        >      >        You can also step through the "presenceHandler"
> method
> >        in
> >        >      converse.js,
> >        >      >        to see what
> >        >      >        happens there.
> >        >      >
> >        >      >        What should happen is that your contacts' chat
> >        statuses need to
> >        >      be
> >        >      >        updated
> >        >      >        (according to their presence stanza's info).
> >        >      >
> >        >      >        After they are updated, the "onChange" method in
> >        >      RosterContactView
> >        >      >        will be
> >        >      >        called to show the new status.
> >        >      >
> >        >      >        If this is a bug in converse.js, then the problem
> is
> >        likely
> >        >      somewhere
> >        >      >        in
> >        >      >        either of those two methods.
> >        >      >
> >        >      >        Regards
> >        >      >        JC
> >        >      >
> >        >      > References
> >        >      >
> >        >      >    Visible links
> >        >      >    1. mailto:[8][11]pawel.ochota@gmail.com
> >        >      >    2. mailto:[9][12]lists@opkode.com
> >        >      >    3. [10][13]http://pastebin.com/zz6NRNK2
> >        >      >    4. [11][14]http://pastebin.com/TMi4LNuF
> >        >
> >        > References
> >        >
> >        >    Visible links
> >        >    1.
> >        [15]
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >        >    2. mailto:[16]lists@opkode.com
> >        >    3.
> >        [17]
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >        >    4. mailto:[18]pawel.ochota@gmail.com
> >        >    5. mailto:[19]lists@opkode.com
> >        >    6. [20]http://pastebin.com/zz6NRNK2
> >        >    7. [21]http://pastebin.com/TMi4LNuF
> >        >    8. mailto:[22]pawel.ochota@gmail.com
> >        >    9. mailto:[23]lists@opkode.com
> >        >   10. [24]http://pastebin.com/zz6NRNK2
> >        >   11. [25]http://pastebin.com/TMi4LNuF
> >
> > References
> >
> >    Visible links
> >    1. mailto:pawel.ochota@gmail.com
> >    2. mailto:lists@opkode.com
> >    3.
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >    4.
> https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
> >    5. mailto:lists@opkode.com
> >    6.
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >    7. mailto:pawel.ochota@gmail.com
> >    8. mailto:lists@opkode.com
> >    9. http://pastebin.com/zz6NRNK2
> >   10. http://pastebin.com/TMi4LNuF
> >   11. mailto:pawel.ochota@gmail.com
> >   12. mailto:lists@opkode.com
> >   13. http://pastebin.com/zz6NRNK2
> >   14. http://pastebin.com/TMi4LNuF
> >   15.
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >   16. mailto:lists@opkode.com
> >   17.
> https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
> >   18. mailto:pawel.ochota@gmail.com
> >   19. mailto:lists@opkode.com
> >   20. http://pastebin.com/zz6NRNK2
> >   21. http://pastebin.com/TMi4LNuF
> >   22. mailto:pawel.ochota@gmail.com
> >   23. mailto:lists@opkode.com
> >   24. http://pastebin.com/zz6NRNK2
> >   25. http://pastebin.com/TMi4LNuF
>

Re: [conversejs] Problem with contact list - everyone is offline

From:
Jc Brand
Date:
2014-09-03 @ 16:13
On Wed, Sep 03, 2014 at 08:13:22AM +0200, Paweł Ochota wrote:
>    hi JC,
>    Everything is ok now, thank You very much for your help :) Converse.js
>    becomes most advance and best solution for web chat :) Greetings!

Glad to hear it, thanks for helping to debug this.




>    2014-09-02 16:46 GMT+02:00 JC Brand <[1]lists@opkode.com>:
> 
>      Hi Paweł
> 
>      I've found and fixed the bug.
>      
[2]https://github.com/jcbrand/converse.js/commit/14ce4a0e6d5b8a5f2c4e949f5f602fdfd73d9bc8
> 
>      The problem was that the chat_status retrieved from sessionStorage was
>      being
>      overridden with 'offline' as soon as the RosterContact was created :0/
> 
>      Can you please double check?
> 
>      Thanks
>      JC
>      On Mon, Sep 01, 2014 at 12:18:42PM +0200, Paweł Ochota wrote:
>      >    Ok I made some changes, but i'm not sure it's the right way to fix
>      this
>      >    "bug":
>      >    this.RosterContact = Backbone.Model.extend({
>      >                initialize: function (attributes, options) {
>      >                    var jid = attributes.jid;
>      >                    if (!attributes.fullname) {
>      >                        attributes.fullname = jid;
>      >                    }
>      >                    if (!attributes.chat_status) {                //
>      <-- My change
>      >                        attributes.chat_status = 'offline';    // <--
>      My change
>      >                    }
>      >                    var attrs = _.extend({
>      >                        'id': jid,
>      >                        'user_id': Strophe.getNodeFromJid(jid),
>      >                        'resources': [],
>      >                        'groups': [],
>      >                        'status': ''
>      >                    }, attributes);
>      >                    this.set(attrs);
>      >                }
>      >            });
> 
>      >    Second change (RosterGroupView):
>      >    initialize: function () {
>      >                    this.model.contacts.on("add", this.addContact,
>      this);
>      >                    this.model.contacts.on("change:chat_status",
>      function (contact) {
>      >                        // This might be optimized by instead of first
>      sorting, finding the correct position in positionContact
>      >                        var contact_temp =
>      this.model.contacts.get(Strophe.getBareJidFromJid(contact.get('jid')));
>       // <--- My change
>      >                        contact_temp.save({'chat_status':
>      contact.get('chat_status')});  // <--- My change
>      >                        this.model.contacts.sort();
>      >                        this.positionContact(contact).render();
>      >                    }, this);
>      >                    this.model.contacts.on("destroy", this.onRemove,
>      this);
>      >                    this.model.contacts.on("remove", this.onRemove,
>      this);
>      >                    converse.roster.on('change:groups',
>      this.onContactGroupChange, this);
>      >                }
>      >    For now it's working, but i'm not sure it's a good way.
>      >
>      >    2014-09-01 11:43 GMT+02:00 Paweł Ochota
>      <[1][3]pawel.ochota@gmail.com>:
>      >
>      >      hi JC
>      >      "If the contact on the previous page was "online" and is now
>      "offline",
>      >      then we
>      >      know the status wasn't properly saved to sessionStorage."
>      >      And this is it. Everyone has offline status, but in previous page
>      some
>      >      people have online status.
>      >
>      >      2014-08-28 18:03 GMT+02:00 JC Brand <[2][4]lists@opkode.com>:
>      >
>      >        On Thu, Aug 28, 2014 at 01:00:31PM +0200, Paweł Ochota wrote:
>      >        >    > What is unique to your problem, as far as I can tell, is
>      that
>      >        your
>      >        >    contacts are
>      >        >    > all offline from the very beginning, correct? In other
>      words,
>      >        their
>      >        >    presences
>      >        >    > never change from offline to anything else?
>      >        >    Not exactly. I'm fighting with server side, because
>      sometimes
>      >        i've got 404
>      >        >    status and my roster is empty, but when I refresh the page
>      I'm
>      >        getting
>      >        >    full list with good statuses. But each next refresh causes
>      >        problem with
>      >        >    contacts list, everyone is offline. Maybe this is problem
>      with
>      >        >    sessionStorage, because when someone change their status
>      then I
>      >        can see
>      >        >    him online, but only when someone change status, not for
>      the
>      >        first time.
>      >        >    So, in this
>      >        >   
>      >       
>      
line [1][3][5]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293 everything
>      >        >    it's ok when status is change.
>      >
>      >        You can double check whether the chat statuses are properly
>      stored in
>      >        sessionStorage by putting a breakpoint here:
>      >
>      >       
>      [4][6]https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
>      >
>      >        Then, call contact.get('chat_status') and see what you get. The
>      status
>      >        should
>      >        be the same as what the contact had on the previous page. Of
>      course,
>      >        you should only do this
>      >        once you've already have loaded the page at least once (with a
>      full
>      >        list with
>      >        good statuses).
>      >
>      >        If the contact on the previous page was "online" and is now
>      "offline",
>      >        then we
>      >        know the status wasn't properly saved to sessionStorage.
>      >
>      >        >    2014-08-28 12:13 GMT+02:00 JC Brand
>      <[2][5][7]lists@opkode.com>:
>      >        >
>      >        >      On Thu, Aug 28, 2014 at 11:53:52AM +0200, Paweł Ochota
>      wrote:
>      >        >      >    Ahhh, presenceHandler is invoking for all coctacts
>      only
>      >        first time,
>      >        >      after
>      >        >      >    refresh is invoking only for me.
>      >        >
>      >        >      That's normal, because after reload you don't receive
>      presences
>      >        for all
>      >        >      your
>      >        >      contacts again.
>      >        >
>      >        >      The reason for this is that they still think you are
>      online and
>      >        that
>      >        >      there is
>      >        >      no need to re-send their presences to you.
>      >        >
>      >        >      The hack to send presence "unavailable" and then a
>      normal
>      >        presence
>      >        >      again, is to
>      >        >      make them think you went away and are back now and
>      therefore
>      >        need to
>      >        >      know
>      >        >      whether they are online or not.
>      >        >
>      >        >      However, from 0.8.x of converse.js, the presence
>      statuses of
>      >        contacts
>      >        >      are
>      >        >      stored in sessionStorage, so you should not need to use
>      the
>      >        above
>      >        >      mentioned
>      >        >      hack, because after page reload, users must have the
>      same
>      >        statuses (as
>      >        >      fetched
>      >        >      from sessionStorage) as they had before the page reload.
>      >        >
>      >        >      What is unique to your problem, as far as I can tell, is
>      that
>      >        your
>      >        >      contacts are
>      >        >      all offline from the very beginning, correct? In other
>      words,
>      >        their
>      >        >      presences
>      >        >      never change from offline to anything else?
>      >        >
>      >        >      If presenceHandler appears to execute fine, then I would
>      check
>      >        here:
>      >        >     
>      >       
>      
[3][6][8]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>      >        >
>      >        >      See if that event handler (which fires when a contact's
>      chat
>      >        status
>      >        >      changes)
>      >        >      gets fired.
>      >        >
>      >        >      That event handler calls render() on the
>      RosterContactView,
>      >        which should
>      >        >      then
>      >        >      update the UI to show the new status of the contact.
>      >        >
>      >        >      JC
>      >        >
>      >        >      >    2014-08-28 11:33 GMT+02:00 Paweł Ochota
>      >        >      <[1][4][7][9]pawel.ochota@gmail.com>:
>      >        >      >
>      >        >      >      Well, in presenceHandler everything it's ok,
>      contacts
>      >        have online
>      >        >      >      statuses, but onChange is not firing at all.
>      Quite
>      >        weird, i'm
>      >        >      searching
>      >        >      >      again.
>      >        >      >
>      >        >      >      2014-08-27 15:02 GMT+02:00 JC Brand
>      >        <[2][5][8][10]lists@opkode.com>:
>      >        >      >
>      >        >      >        On Wed, Aug 27, 2014 at 12:17:47PM +0200, Paweł
>      Ochota
>      >        wrote:
>      >        >      >        >    Hi JC.
>      >        >      >        >    I'm using last version of converse (my
>      custom
>      >        build with
>      >        >      little
>      >        >      >        >    differences like avatars). Well, my RID
>      >        incrementation is
>      >        >      in the
>      >        >      >        server
>      >        >      >        >    side, when I increment RID in client side
>      i've
>      >        got 404
>      >        >      from the
>      >        >      >        server and
>      >        >      >        >    next request is ok (new RID and SID from
>      the
>      >        server). When
>      >        >      this
>      >        >      >        request is
>      >        >      >        >    good, I've got output:
>      >        >      >        >   
>      [1][3][6][9][11]http://pastebin.com/zz6NRNK2
>      >        >      >
>      >        >      >        OK, looking at this output, I see that you do
>      >        broadcast your
>      >        >      presence,
>      >        >      >        and then
>      >        >      >        you get the presences back from all your
>      contacts.
>      >        >      >        >    But after refresh I've got: 
>      >        >      >        >   
>      [2][4][7][10][12]http://pastebin.com/TMi4LNuF
>      >        >      >
>      >        >      >        In this case, you also broadcast your presence,
>      but
>      >        don't get
>      >        >      your
>      >        >      >        contact's
>      >        >      >        presences back. This is normal and expected
>      (although
>      >        it was
>      >        >      the cause
>      >        >      >        of the
>      >        >      >        problem discussed in the thread I linked to in
>      my
>      >        previous
>      >        >      email).
>      >        >      >        >    Maybe this is server side issue, what do
>      you
>      >        think? Are
>      >        >      you using
>      >        >      >        ejabberd
>      >        >      >        >    or Openfire when you are testing converse?
>      >        >      >
>      >        >      >        I use ejabberd and prosody, but many other
>      people use
>      >        openfire.
>      >        >      >
>      >        >      >        You can try with a different XMPP server and
>      see if
>      >        the problem
>      >        >      >        persists.
>      >        >      >
>      >        >      >        You can also step through the "presenceHandler"
>      method
>      >        in
>      >        >      converse.js,
>      >        >      >        to see what
>      >        >      >        happens there.
>      >        >      >
>      >        >      >        What should happen is that your contacts' chat
>      >        statuses need to
>      >        >      be
>      >        >      >        updated
>      >        >      >        (according to their presence stanza's info).
>      >        >      >
>      >        >      >        After they are updated, the "onChange" method
>      in
>      >        >      RosterContactView
>      >        >      >        will be
>      >        >      >        called to show the new status.
>      >        >      >
>      >        >      >        If this is a bug in converse.js, then the
>      problem is
>      >        likely
>      >        >      somewhere
>      >        >      >        in
>      >        >      >        either of those two methods.
>      >        >      >
>      >        >      >        Regards
>      >        >      >        JC
>      >        >      >
>      >        >      > References
>      >        >      >
>      >        >      >    Visible links
>      >        >      >    1. mailto:[8][11][13]pawel.ochota@gmail.com
>      >        >      >    2. mailto:[9][12][14]lists@opkode.com
>      >        >      >    3. [10][13][15]http://pastebin.com/zz6NRNK2
>      >        >      >    4. [11][14][16]http://pastebin.com/TMi4LNuF
>      >        >
>      >        > References
>      >        >
>      >        >    Visible links
>      >        >    1.
>      >       
>      
[15][17]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>      >        >    2. mailto:[16][18]lists@opkode.com
>      >        >    3.
>      >       
>      
[17][19]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>      >        >    4. mailto:[18][20]pawel.ochota@gmail.com
>      >        >    5. mailto:[19][21]lists@opkode.com
>      >        >    6. [20][22]http://pastebin.com/zz6NRNK2
>      >        >    7. [21][23]http://pastebin.com/TMi4LNuF
>      >        >    8. mailto:[22][24]pawel.ochota@gmail.com
>      >        >    9. mailto:[23][25]lists@opkode.com
>      >        >   10. [24][26]http://pastebin.com/zz6NRNK2
>      >        >   11. [25][27]http://pastebin.com/TMi4LNuF
>      >
>      > References
>      >
>      >    Visible links
>      >    1. mailto:[28]pawel.ochota@gmail.com
>      >    2. mailto:[29]lists@opkode.com
>      >    3.
>      [30]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>      >    4.
>      [31]https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
>      >    5. mailto:[32]lists@opkode.com
>      >    6.
>      [33]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>      >    7. mailto:[34]pawel.ochota@gmail.com
>      >    8. mailto:[35]lists@opkode.com
>      >    9. [36]http://pastebin.com/zz6NRNK2
>      >   10. [37]http://pastebin.com/TMi4LNuF
>      >   11. mailto:[38]pawel.ochota@gmail.com
>      >   12. mailto:[39]lists@opkode.com
>      >   13. [40]http://pastebin.com/zz6NRNK2
>      >   14. [41]http://pastebin.com/TMi4LNuF
>      >   15.
>      [42]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>      >   16. mailto:[43]lists@opkode.com
>      >   17.
>      [44]https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>      >   18. mailto:[45]pawel.ochota@gmail.com
>      >   19. mailto:[46]lists@opkode.com
>      >   20. [47]http://pastebin.com/zz6NRNK2
>      >   21. [48]http://pastebin.com/TMi4LNuF
>      >   22. mailto:[49]pawel.ochota@gmail.com
>      >   23. mailto:[50]lists@opkode.com
>      >   24. [51]http://pastebin.com/zz6NRNK2
>      >   25. [52]http://pastebin.com/TMi4LNuF
> 
> References
> 
>    Visible links
>    1. mailto:lists@opkode.com
>    2. 
https://github.com/jcbrand/converse.js/commit/14ce4a0e6d5b8a5f2c4e949f5f602fdfd73d9bc8
>    3. mailto:pawel.ochota@gmail.com
>    4. mailto:lists@opkode.com
>    5. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>    6. https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
>    7. mailto:lists@opkode.com
>    8. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>    9. mailto:pawel.ochota@gmail.com
>   10. mailto:lists@opkode.com
>   11. http://pastebin.com/zz6NRNK2
>   12. http://pastebin.com/TMi4LNuF
>   13. mailto:pawel.ochota@gmail.com
>   14. mailto:lists@opkode.com
>   15. http://pastebin.com/zz6NRNK2
>   16. http://pastebin.com/TMi4LNuF
>   17. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   18. mailto:lists@opkode.com
>   19. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   20. mailto:pawel.ochota@gmail.com
>   21. mailto:lists@opkode.com
>   22. http://pastebin.com/zz6NRNK2
>   23. http://pastebin.com/TMi4LNuF
>   24. mailto:pawel.ochota@gmail.com
>   25. mailto:lists@opkode.com
>   26. http://pastebin.com/zz6NRNK2
>   27. http://pastebin.com/TMi4LNuF
>   28. mailto:pawel.ochota@gmail.com
>   29. mailto:lists@opkode.com
>   30. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   31. https://github.com/jcbrand/converse.js/blob/master/converse.js#L3598
>   32. mailto:lists@opkode.com
>   33. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   34. mailto:pawel.ochota@gmail.com
>   35. mailto:lists@opkode.com
>   36. http://pastebin.com/zz6NRNK2
>   37. http://pastebin.com/TMi4LNuF
>   38. mailto:pawel.ochota@gmail.com
>   39. mailto:lists@opkode.com
>   40. http://pastebin.com/zz6NRNK2
>   41. http://pastebin.com/TMi4LNuF
>   42. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   43. mailto:lists@opkode.com
>   44. https://github.com/jcbrand/converse.js/blob/v0.8.1/converse.js#L3293
>   45. mailto:pawel.ochota@gmail.com
>   46. mailto:lists@opkode.com
>   47. http://pastebin.com/zz6NRNK2
>   48. http://pastebin.com/TMi4LNuF
>   49. mailto:pawel.ochota@gmail.com
>   50. mailto:lists@opkode.com
>   51. http://pastebin.com/zz6NRNK2
>   52. http://pastebin.com/TMi4LNuF

Re: [conversejs] Problem with contact list - everyone is offline

From:
Jc Brand
Date:
2014-08-27 @ 08:33
Hi Paweł

Please always make sure to mention the version of converse.js you are using.


On Tue, Aug 26, 2014 at 05:10:17PM +0200, Paweł Ochota wrote:
>    Hi. I'm using converse.js in my job to create CRM's chat for clients, with
>    php and ejabberd. I have a problem with contacts list. When user is
>    opening CRM, he always see offline chat list, same after refresh (I have
>    prebind options true).

There recently was a relatively long thread about something similar:

http://librelist.com/browser//conversejs/2014/5/30/re-converse-js-noone-online-after-reload-w-prebind-169/

However, in that case, contacts were offline only after the page was reloaded,
and not initially.
 
>    This is my debug code about roster:
>
>    <body rid="5802029811"
>    xmlns="http://jabber.org/protocol/httpbind"
>    sid="663e84de7812b648afb210d08d95bfbe6f1ad53d">
>    <iq from="admin.test@jabber.test.pl" id="enablecarbons" type="set"
>    xmlns="jabber:client">
>    <enable xmlns="urn:xmpp:carbons:2"></enable>
>    </iq>
>    <iq type="get" to="admin.test@jabber.test.pl" xmlns="jabber:client"
>    id="1:sendIQ">
>    <vcard xmlns="vcard-temp"></vcard>
>    </iq>
>    <iq to="conference.jabber.test.pl"
>    from="admin.test@jabber.test.pll" type="get" xmlns="jabber:client"
>    id="2:sendIQ">
>    <query xmlns="http://jabber.org/protocol/disco#items"></query>
>    </iq>
>    <iq type="get" id="3:roster" xmlns="jabber:client">
>    <query xmlns="jabber:iq:roster"></query>
>    </iq>
>    </body>
>    ----------------
>    <body xmlns="http://jabber.org/protocol/httpbind">
>    <iq xmlns="jabber:client" from="admin.test@jabber.test.pl"
>    to="admin.test@jabber.test.pl/204381162140958906999419"
>    id="3:roster" type="result">
>    <query xmlns="jabber:iq:roster">
>    <item subscription="both" name="Test User1"
>    jid="test.user1@jabber.test.pl">…</item>
>    <item subscription="both" name="Test User2"
>    jid="test.user2@jabber.test.pl">…</item>
>    </query>
>    </iq>
>    </body>

In the last stanza, <iq type="result>, you are receiving your roster contacts
from the server.

The rosterHandler method in converse.js will be called to handle this.

In rosterHandler, after your contacts have been added to your roster,
converse.js will broadcast your presence, after which you will receive the
presence statuses of your contacts.

See here:

https://github.com/jcbrand/converse.js/blob/c9958182ff3d7bcbc326ab74051a9a846b71af6a/converse.js#L3156

I don't see the presence stanza being sent out in the debug output you pasted
above.

If your own presence stanza is not sent out, you won't get the presence statuses
of your contacts.

So that is likely the problem. Why it's not being sent out, I don't know.

Can you put a breakpoint on that line I linked to above and see whether it
gets called, and whether your presence is sent out?

Regards
JC