librelist archives

« back to archive

Problems with BOSH prebinding and ejabberd

Problems with BOSH prebinding and ejabberd

From:
Brian Tiemann
Date:
2014-11-06 @ 15:44
Hoping someone here has experience with ejabberd, because I suspect that’s
where my problem lies.

I’m trying to integrate Converse.js with ejabberd through its internal 
BOSH module. I have a working implementation of the Django BOSH client 
from here: 
https://github.com/TracyWebTech/django-conversejs/blob/master/conversejs/boshclient.py
feeding me an authenticated set of jid/rid/sid, which I then pass to the 
converse.initialize options with prebind: true.

If I try to launch Converse with prebinding, it never seems to create a 
session. The ejabberd logs never show me this line, which I do see if I 
log into Converse manually with a jid and password:


=INFO REPORT==== 2014-11-05 17:38:04 ===
I(<0.9944.0>:ejabberd_c2s:785) : 
({socket_state,ejabberd_http_bind,{http_bind,<0.9943.0>,{{24,39,134,222},61376}},ejabberd_http_bind})
Accepted authentication for t_test by []

=INFO REPORT==== 2014-11-05 17:38:05 ===
I(<0.9944.0>:ejabberd_c2s:938) : 
({socket_state,ejabberd_http_bind,{http_bind,<0.9943.0>,{{24,39,134,222},61376}},ejabberd_http_bind})
Opened session for t_test@xxx.com/converse.js-47626624


Instead, with prebinding I get:


=INFO REPORT==== 2014-11-05 17:39:31 ===
I(<0.9958.0>:ejabberd_c2s:767) : 
({socket_state,ejabberd_http_bind,{http_bind,<0.9957.0>,{{10,0,0,47},39766}},ejabberd_http_bind})
Accepted authentication for t_test by ejabberd_auth_internal

=INFO REPORT==== 2014-11-05 17:39:32 ===
I(<0.680.0>:ejabberd_listener:281) : (#Port<0.30689>) Accepted connection 
{{24,39,134,222},61877} -> {{10,0,0,112},5280}

=INFO REPORT==== 2014-11-05 17:39:32 ===
I(<0.9959.0>:ejabberd_http:143) : started: {gen_tcp,#Port<0.30689>}


I can’t tell whether the “Accepted connection” and “started” lines are 
helpful; it seems that they behave differently depending on whether I’m 
prebinding or not. They happen on every request from what I can tell.

Regardless of whether I’m prebinding or not, the debug logs from Converse 
seem to show that it’s sending the same stanza right after login:


[Log] <body rid=​"3295748985" 
xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" 
sid=​"575f7364a87ec99c0aba6657c3a514b8dbf76b4c">​ (converse.min.js, line 
229)
<iq type=​"get" id=​"1:​roster" xmlns=​"jabber:​client">​
<query xmlns=​"jabber:​iq:​roster">​</query>​
</iq>​
</body>​


But if I’m prebinding, that’s the only stanza it sends; if I’m not, it 
follows it later with several other requests (presence, subscribe, etc).

I need some insight into where the problem is—on the Converse side 
(doubtful, since I’ve tried with Candy-chat and it seems to behave 
similarly), the ejabberd side, or the Django BOSH client.

Thanks very much—

Re: [conversejs] Problems with BOSH prebinding and ejabberd

From:
Jc Brand
Date:
2014-11-08 @ 00:28
On Thu, Nov 06, 2014 at 10:44:10AM -0500, Brian Tiemann wrote:
> Hoping someone here has experience with ejabberd, because I suspect 
that’s where my problem lies.
> 
> I’m trying to integrate Converse.js with ejabberd through its internal 
BOSH module. I have a working implementation of the Django BOSH client 
from here: 
https://github.com/TracyWebTech/django-conversejs/blob/master/conversejs/boshclient.py
feeding me an authenticated set of jid/rid/sid, which I then pass to the 
converse.initialize options with prebind: true.
> 
> If I try to launch Converse with prebinding, it never seems to create a session.

Reading your email, it's not clear to me exactly what's happening that causes
you to come to this conclusion.

> The ejabberd logs never show me this line, which I do see if I log into 
Converse manually with a jid and password:
> 
> 
> =INFO REPORT==== 2014-11-05 17:38:04 ===
> I(<0.9944.0>:ejabberd_c2s:785) : 
({socket_state,ejabberd_http_bind,{http_bind,<0.9943.0>,{{24,39,134,222},61376}},ejabberd_http_bind})
Accepted authentication for t_test by []
> 
> =INFO REPORT==== 2014-11-05 17:38:05 ===
> I(<0.9944.0>:ejabberd_c2s:938) : 
({socket_state,ejabberd_http_bind,{http_bind,<0.9943.0>,{{24,39,134,222},61376}},ejabberd_http_bind})
Opened session for t_test@xxx.com/converse.js-47626624
> 
> 
> Instead, with prebinding I get:
> 
> 
> =INFO REPORT==== 2014-11-05 17:39:31 ===
> I(<0.9958.0>:ejabberd_c2s:767) : 
({socket_state,ejabberd_http_bind,{http_bind,<0.9957.0>,{{10,0,0,47},39766}},ejabberd_http_bind})
Accepted authentication for t_test by ejabberd_auth_internal
> 
> =INFO REPORT==== 2014-11-05 17:39:32 ===
> I(<0.680.0>:ejabberd_listener:281) : (#Port<0.30689>) Accepted 
connection {{24,39,134,222},61877} -> {{10,0,0,112},5280}
> 
> =INFO REPORT==== 2014-11-05 17:39:32 ===
> I(<0.9959.0>:ejabberd_http:143) : started: {gen_tcp,#Port<0.30689>}

I don't see any errors logged, looks dandy (although I'm by no means an 
ejabberd logs whisperer).
  
> I can’t tell whether the “Accepted connection” and “started” lines are 
helpful; it seems that they behave differently depending on whether I’m 
prebinding or not.

It's understandable that they'd behave subtly different, they are two different
ways of connecting to the server.

> They happen on every request from what I can tell.

I think that's ok. With each request, you are re-establishing a connection
(i.e. attaching to the prebinded connection) to the XMPP server.
  
> Regardless of whether I’m prebinding or not, the debug logs from 
Converse seem to show that it’s sending the same stanza right after login:
> 
> [Log] <body rid="3295748985" xmlns="http://jabber.org/protocol/httpbind"
sid="575f7364a87ec99c0aba6657c3a514b8dbf76b4c"> (converse.min.js, line 
229)
> <iq type="get" id="1:roster" xmlns="jabber:client">
> <query xmlns="jabber:iq:roster"></query>
> </iq>
> </body>

Yes, it's querying for the roster. If it gets this far, then it must have
gotten feedback after attaching that the connection is established.
 
> But if I’m prebinding, that’s the only stanza it sends; if I’m not, it 
follows it later with several other requests (presence, subscribe, etc).
> 
> I need some insight into where the problem is—on the Converse side 
(doubtful, since I’ve tried with Candy-chat and it seems to behave 
similarly), the ejabberd side, or the Django BOSH client.

I don't see any errors or warnings in the logs you posted.

Ejabberd logs a lot, and you posted very little. Are you sure you're not 
missing some vital info in the logs?

I don't see anything pointing towards a bug in converse.js.

You could try a standalone BOSH server, such as Punjab or the Node.js one, and
see if that fixes things.

Or try a different XMPP server, such as Prosody. 

JC