librelist archives

« back to archive

Message doubling in chat box.

Message doubling in chat box.

From:
Дегрик Роман
Date:
2014-10-29 @ 14:14
<div>29.10.2014, 17:02, "Дегрик Роман" 
<r.degrik@yandex.ru>:</div><div> </div><div><div>Hello 
everyone!</div><div> </div><div>I'm trying to establish pre-bind 
connection with local ejabberd server through slightly rewrited JC's 
BOSHClient (from Django example) and stucking into a pretty strange 
problem: outcoming messages are doubling in the chat box when forwarding 
is on (incoming messages are ok).</div><div> </div><div>Here is stanza 
conversation:</div><div> </div><div>-----</div><div>POST 
localhost:5280/http-bind</div><div> </div><div><body 
rid='<span>3152129</span>' xmlns='<a 
href="http://jabber.org/protocol/httpbind'">http://jabber.org/protocol/httpbind'</a>
sid='6735e9948a74e559454cde735c30b7fd9ab17155'></div><div>  <message
to='wiggle@localhost' type='chat' xmlns='jabber:client'></div><div>    
<composing xmlns='<a 
href="http://jabber.org/protocol/chatstates'/">http://jabber.org/protocol/chatstates'/</a>></div><div> 

</message></div><div></body></div><div><div>-----</div><div>HTTP
200 OK</div><div><div><div><pre><body 
xmlns='http://jabber.org/protocol/httpbind'><br />  <message 
xmlns='jabber:client' from='cassum@localhost/23970353071414589811172472' 
to='cassum@localhost' type='chat' id='1414589829497'><br />    
<forwarded xmlns='urn:xmpp:forward:0'><delay 
xmns='urn:xmpp:delay' stamp='1414589829497'/><br />      <message 
xmlns='jabber:client' from='cassum@localhost' to='wiggle@localhost' 
type='chat' id='1414589829497'><br />        
<body>test</body><br />        <active 
xmlns='http://jabber.org/protocol/chatstates'/><br />      
</message><br />    </forwarded><br />  </message><br 
/></body></pre><div>-----</div><div><div>POST 
localhost:5280/http-bind</div><div> </div><body 
rid='<span>3152130</span>' xmlns='<a 
href="http://jabber.org/protocol/httpbind'">http://jabber.org/protocol/httpbind'</a>
sid='6735e9948a74e559454cde735c30b7fd9ab17155'></div><div>  <message
from='cassum@localhost' to='wiggle@localhost' type='chat' 
id='<span>1414589829497</span>' xmlns='jabber:client'></div><div>    
<body>test</body></div><div>    <active xmlns='<a 
href="http://jabber.org/protocol/chatstates'/">http://jabber.org/protocol/chatstates'/</a>></div><div> 
</message></div><div>  <message to='cassum@localhost' type='chat'
id='<span>1414589829497</span>' xmlns='jabber:client'></div><div>    
<forwarded xmlns='urn:xmpp:forward:0'></div><div>      <delay 
xmns='urn:xmpp:delay' 
stamp='<span>1414589829497</span>'/></div><div>      <message 
from='cassum@localhost' to='wiggle@localhost' type='chat' 
id='<span>1414589829497</span>' 
xmlns='jabber:client'></div><div>        
<body>test</body></div><div>        <active xmlns='<a 
href="http://jabber.org/protocol/chatstates'/">http://jabber.org/protocol/chatstates'/</a>></div><div>     
</message></div><div>    </forwarded></div><div>  
</message></div><div></body></div><div>-----</div><div> </div><div>And
so on. So i think the problem is somehow connected to <resourcepart>
of JID, but idk what am I doing wrong. Please tell me if it is a know 
issue or where and how should i start my debugging and what's actually 
goes wrong here.</div><div> </div><div>With best 
regards,</div><div>Roman</div></div></div></div></div></div>

Re: Message doubling in chat box.

From:
Дегрик Роман
Date:
2014-10-29 @ 14:20
Sorry about first message, i didn't expected it to be displayed as plain text

Here is original message:
----------------------------
Hello everyone!

I'm trying to establish pre-bind connection with local ejabberd server 
through slightly rewrited JC's BOSHClient (from Django example) and 
stucking into a pretty strange problem: outcoming messages are doubling in
the chat box when forwarding is on (incoming messages are ok).

Here is stanza conversation:

-----
POST localhost:5280/http-bind

<body rid='3152129' xmlns='http://jabber.org/protocol/httpbind' 
sid='6735e9948a74e559454cde735c30b7fd9ab17155'>
  <message to='wiggle@localhost' type='chat' xmlns='jabber:client'>
    <composing xmlns='http://jabber.org/protocol/chatstates'/>
  </message>
</body>
-----
HTTP 200 OK

<body xmlns='http://jabber.org/protocol/httpbind'>
  <message xmlns='jabber:client' 
from='cassum@localhost/23970353071414589811172472' to='cassum@localhost' 
type='chat' id='1414589829497'>
    <forwarded xmlns='urn:xmpp:forward:0'><delay xmns='urn:xmpp:delay' 
stamp='1414589829497'/>
     <message xmlns='jabber:client' from='cassum@localhost' 
to='wiggle@localhost' type='chat' id='1414589829497'>
       <body>test</body>
       <active xmlns='http://jabber.org/protocol/chatstates'/>
      </message>
    </forwarded>
  </message>
</body>
-----
POST localhost:5280/http-bind

<body rid='3152130' xmlns='http://jabber.org/protocol/httpbind' 
sid='6735e9948a74e559454cde735c30b7fd9ab17155'>
  <message from='cassum@localhost' to='wiggle@localhost' type='chat' 
id='1414589829497' xmlns='jabber:client'>
    <body>test</body>
    <active xmlns='http://jabber.org/protocol/chatstates'/>
  </message>
  <message to='cassum@localhost' type='chat' id='1414589829497' 
xmlns='jabber:client'>
    <forwarded xmlns='urn:xmpp:forward:0'>
      <delay xmns='urn:xmpp:delay' stamp='1414589829497'/>
      <message from='cassum@localhost' to='wiggle@localhost' type='chat' 
id='1414589829497' xmlns='jabber:client'>
        <body>test</body>
        <active xmlns='http://jabber.org/protocol/chatstates'/>
      </message>
    </forwarded>
  </message>
</body>
-----

And so on. So i think the problem is somehow connected to <resourcepart> 
of JID, but idk what am I doing wrong. Please tell me if it is a know 
issue or where and how should i start my debugging and what's actually 
goes wrong here.

With best regards,
Roman

Re: [conversejs] Re: Message doubling in chat box.

From:
Jc Brand
Date:
2014-10-30 @ 12:31
On Wed, Oct 29, 2014 at 05:20:49PM +0300, Дегрик Роман wrote:
> Hello everyone!
> 
> I'm trying to establish pre-bind connection with local ejabberd server 
through slightly rewrited JC's BOSHClient (from Django example) and 
stucking into a pretty strange problem: outcoming messages are doubling in
the chat box when forwarding is on (incoming messages are ok).
> 
> Here is stanza conversation:

<snip>
  
> POST localhost:5280/http-bind
> 
> <body rid='3152130' xmlns='http://jabber.org/protocol/httpbind' 
sid='6735e9948a74e559454cde735c30b7fd9ab17155'>
>   <message from='cassum@localhost' to='wiggle@localhost' type='chat' 
id='1414589829497' xmlns='jabber:client'>
>     <body>test</body>
>     <active xmlns='http://jabber.org/protocol/chatstates'/>
>   </message>
>   <message to='cassum@localhost' type='chat' id='1414589829497' 
xmlns='jabber:client'>
>     <forwarded xmlns='urn:xmpp:forward:0'>
>       <delay xmns='urn:xmpp:delay' stamp='1414589829497'/>
>       <message from='cassum@localhost' to='wiggle@localhost' type='chat'
id='1414589829497' xmlns='jabber:client'>
>         <body>test</body>
>         <active xmlns='http://jabber.org/protocol/chatstates'/>
>       </message>
>     </forwarded>
>   </message>
> </body>
> -----
> 
> And so on. So i think the problem is somehow connected to <resourcepart>
of JID, but idk what am I doing wrong. Please tell me if it is a know 
issue or where and how should i start my debugging and what's actually 
goes wrong here.

The duplicate messages are forwarded messages, see the <forward> XML element in
them.

Are you using the "forward_messages" setting of converse.js?
https://conversejs.org/docs/html/index.html#forward-messages

JC

Re: [conversejs] Re: Message doubling in chat box.

From:
Дегрик Роман
Date:
2014-10-30 @ 12:44
> The duplicate messages are forwarded messages, see the <forward> XML element in
> them.
>
> Are you using the "forward_messages" setting of converse.js?

I know that they are forwarded, and I have mentioned, that I'm using forwarding:
>  ... outcoming messages are doubling in the chat box when forwarding is 
on (incoming messages are ok).

Specifying the question: why exactly mesages are forwarded to the client 
that have sent them? Am I doing something wrong or it's `forward_messages`
trouble? Or maybe I've messed up with my resource binding?


30.10.2014, 15:32, "JC Brand" <lists@opkode.com>:
> On Wed, Oct 29, 2014 at 05:20:49PM +0300, Дегрик Роман wrote:
>>  Hello everyone!
>>
>>  I'm trying to establish pre-bind connection with local ejabberd server
through slightly rewrited JC's BOSHClient (from Django example) and 
stucking into a pretty strange problem: outcoming messages are doubling in
the chat box when forwarding is on (incoming messages are ok).
>>
>>  Here is stanza conversation:
>
> <snip>
>>  POST localhost:5280/http-bind
>>
>>  <body rid='3152130' xmlns='http://jabber.org/protocol/httpbind' 
sid='6735e9948a74e559454cde735c30b7fd9ab17155'>
>>    <message from='cassum@localhost' to='wiggle@localhost' type='chat' 
id='1414589829497' xmlns='jabber:client'>
>>      <body>test</body>
>>      <active xmlns='http://jabber.org/protocol/chatstates'/>
>>    </message>
>>    <message to='cassum@localhost' type='chat' id='1414589829497' 
xmlns='jabber:client'>
>>      <forwarded xmlns='urn:xmpp:forward:0'>
>>        <delay xmns='urn:xmpp:delay' stamp='1414589829497'/>
>>        <message from='cassum@localhost' to='wiggle@localhost' 
type='chat' id='1414589829497' xmlns='jabber:client'>
>>          <body>test</body>
>>          <active xmlns='http://jabber.org/protocol/chatstates'/>
>>        </message>
>>      </forwarded>
>>    </message>
>>  </body>
>>  -----
>>
>>  And so on. So i think the problem is somehow connected to 
<resourcepart> of JID, but idk what am I doing wrong. Please tell me if it
is a know issue or where and how should i start my debugging and what's 
actually goes wrong here.
>
> The duplicate messages are forwarded messages, see the <forward> XML element in
> them.
>
> Are you using the "forward_messages" setting of converse.js?
> https://conversejs.org/docs/html/index.html#forward-messages
>
> JC

Re: [conversejs] Re: Message doubling in chat box.

From:
Jc Brand
Date:
2014-10-30 @ 14:19
On Thu, Oct 30, 2014 at 03:44:12PM +0300, Дегрик Роман wrote:
> > The duplicate messages are forwarded messages, see the <forward> XML 
element in
> > them.
> >
> > Are you using the "forward_messages" setting of converse.js?
> 
> I know that they are forwarded, and I have mentioned, that I'm using forwarding:
> >  ... outcoming messages are doubling in the chat box when forwarding 
is on (incoming messages are ok).

Oops, I missed that, sorry.
 
> Specifying the question: why exactly mesages are forwarded to the client
that have sent them? Am I doing something wrong or it's `forward_messages`
trouble? Or maybe I've messed up with my resource binding?

I'm not completely sure why messages are being duplicated.

I agree it looks like the problem might be related to your resource value, or
that you are sending messages from a bare jid.

To debug, you can put breakpoints here:

https://github.com/jcbrand/converse.js/blob/2df209363aa81286a8b4dfa579fabb74f2d2b734/converse.js#L2847

and here:

https://github.com/jcbrand/converse.js/blob/2df209363aa81286a8b4dfa579fabb74f2d2b734/converse.js#L1164