I'm trying to understand what's going on here, and would appreciate
any insights any of you can share. My situation is this:
1. I can get connected to my XMPP server over BOSH using Strophe just
fine, and everything works perfectly. I have a page that
automatically connects me on page load.
2. However, if I refresh my browser, Strophe connects again to my
XMPP server (using the same credentials as its previous connection
attempt that worked above, in step 1), but then is immediately
disconnected.
Is my XMPP server not happy with the fact that a second connection
with the same JID is being created before the first one times out?
Here's all the lines from my ejabberd log file during a sample session
to demonstrate the problem. I've annotated it with #--comments--:
#=================
# START THE SERVER
#=================
=INFO REPORT==== 13-Jan-2010::09:02:03 ===
I(<0.40.0>:ejabberd_app:69) : ejabberd 2.1.1 is started in the node
ejabberd@localhost
#=================
#LOAD MY PAGE AND HAVE STROPHE CONNECT
#=================
=INFO REPORT==== 13-Jan-2010::09:02:21 ===
I(<0.377.0>:ejabberd_listener:229) : (#Port<0.420>) Accepted
connection {{192,168,0,148},59949} -> {{192,168,0,148},5280}
=INFO REPORT==== 13-Jan-2010::09:02:21 ===
I(<0.378.0>:ejabberd_http:137) : started: {gen_tcp,#Port<0.420>}
=INFO REPORT==== 13-Jan-2010::09:02:21 ===
I(<0.380.0>:ejabberd_c2s:566) : ({socket_state,ejabberd_http_bind,
{http_bind,<0.379.0>,{{192,168,0,148},59949}},ejabberd_http_bind})
Accepted authentication for 1 by ejabberd_auth_external
=INFO REPORT==== 13-Jan-2010::09:02:22 ===
I(<0.380.0>:ejabberd_c2s:816) : ({socket_state,ejabberd_http_bind,
{http_bind,<0.379.0>,{{192,168,0,148},59949}},ejabberd_http_bind})
Opened session for 1...@enterprise-g.local/10999514401263333742275944
#=================
#JOIN A MUC ROOM, PART OF MY CODE
#=================
=INFO REPORT==== 13-Jan-2010::09:02:22 ===
I(<0.382.0>:mod_muc_room:126) : Created MUC room
12...@conference.enterprise-g.local by 1...@enterprise-g.local/
10999514401263333742275944
#=================
#REFRESH THE BROWSER, CAUSING A RECONNECT WITH THE SAME CREDENTIALS AS
BEFORE
#=================
=INFO REPORT==== 13-Jan-2010::09:03:26 ===
I(<0.377.0>:ejabberd_listener:229) : (#Port<0.441>) Accepted
connection {{192,168,0,148},60002} -> {{192,168,0,148},5280}
=INFO REPORT==== 13-Jan-2010::09:03:26 ===
I(<0.383.0>:ejabberd_http:137) : started: {gen_tcp,#Port<0.441>}
=INFO REPORT==== 13-Jan-2010::09:03:26 ===
I(<0.385.0>:ejabberd_c2s:566) : ({socket_state,ejabberd_http_bind,
{http_bind,<0.384.0>,{{192,168,0,148},60002}},ejabberd_http_bind})
Accepted authentication for 1 by ejabberd_auth_external
=INFO REPORT==== 13-Jan-2010::09:03:27 ===
I(<0.385.0>:ejabberd_c2s:816) : ({socket_state,ejabberd_http_bind,
{http_bind,<0.384.0>,{{192,168,0,148},60002}},ejabberd_http_bind})
Opened session for 1...@enterprise-g.local/38609424581263333807340070
#=================
EVERYTHING LOOKS GOOD, EXCEPT THE NEXT THING THAT HAPPENS, BELOW, IS A
DISCONNECT FROM THE SERVER
#=================
=INFO REPORT==== 13-Jan-2010::09:03:28 ===
I(<0.385.0>:ejabberd_c2s:1329) : ({socket_state,ejabberd_http_bind,
{http_bind,<0.384.0>,{{192,168,0,148},60002}},ejabberd_http_bind})
Close session for 1...@enterprise-g.local/38609424581263333807340070
I'm all good. Sorry for the noise here.
-g
Are the credentials hard-coded in the page?
> 2. However, if I refresh my browser, Strophe connects again to my
> XMPP server (using the same credentials as its previous connection
> attempt that worked above, in step 1), but then is immediately
> disconnected.
Sounds like a resource conflict, and ejabberd is configured to boot
the new one, not the old one. Try not specifying a resource and see if
that fixes it?
> Here's all the lines from my ejabberd log file during a sample session
> to demonstrate the problem. I've annotated it with #--comments--:
It would be far more helpful to post the Strophe rawInput/Output logs.
ejabberd will respond to the auth attempt with a failure stanza, and
that will probably tell us what is happening.
jack.
Ah, good that you figured it out. You should be able to handle the
nick conflict pretty easily with a new <presence> handler.
jack.
--
You received this message because you are subscribed to the Google Groups "Strophe" group.
To post to this group, send email to str...@googlegroups.com.
To unsubscribe from this group, send email to strophe+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/strophe?hl=en.
That may solve it most of the time, but it's still possible your app
will encounter some error on join (perhaps even a duplicate nick if
another participant wants to be malicious). Just food for thought.
jack.