Can't send messages

93 views
Skip to first unread message

Daniel

unread,
Feb 24, 2009, 6:33:59 AM2/24/09
to Strophe
Hi,
I'm currently developing a webchat and have managed to get Strophe js
to work partially with an Openfire server. What I can do is login,
receive messages from another user (currently on Adium) and log out. I
cannot send messages, the only feedback I get is that sometimes the
Openfire log gives me this message:

[code]
Packets could not be found for session 407080f5 cannotbe delivered to
client
[/code]

The function where I try to send a message look like this:
[code]
function sendMsg(){
var to = 'user2@server';
var msg = $('#outgoing').val();

console.log('sending message: '+msg);

con.send($msg({to: to, from:con.jid, type: 'chat'}).c('body').t
(msg).tree());

var time = new Date();
$('#chatwindow').append('<div class="us"><div class="header">Du
'+time.getHours()+':'+time.getMinutes()+'.'+time.getSeconds()+'</
div>');
$('#chatwindow').append('<div class="messagebody">'+msg+'</div></
div>');

$('#outgoing').val() = "";


}
[/code]
where con is the object returned from the new Strophe.Connection();

Anyone have any clues?

Daniel

unread,
Feb 24, 2009, 6:48:42 AM2/24/09
to Strophe
I'm also noticing this in the error log:

Going to buffer response body of large or unknown size. Using
getResponseBodyAsStream instead is recommended.

Jack Moffitt

unread,
Feb 24, 2009, 7:33:05 AM2/24/09
to str...@googlegroups.com
>                        con.send($msg({to: to, from:con.jid, type: 'chat'}).c('body').t
> (msg).tree());

You don't need to set the from, and this is actually discouraged. The
server will always rewrite this for you to prevent you from spoofing
another JID, so its best to omit it.

Can you hook up rawInput and rawOutput to print the wire traffic and
post that log minus your login credentials for us to look at? It
might help figure out what is going on.

jack.

Favio Manríquez León

unread,
Feb 24, 2009, 8:11:15 AM2/24/09
to str...@googlegroups.com
On Tue, Feb 24, 2009 at 4:33 AM, Jack Moffitt <meta...@gmail.com> wrote:
> You don't need to set the from, and this is actually discouraged.  The
> server will always rewrite this for you to prevent you from spoofing
> another JID, so its best to omit it.
Heh, I've been living under a rock for a few months now xD At least
now I know that. Great! :)

Daniel

unread,
Feb 25, 2009, 4:36:22 AM2/25/09
to Strophe
This is the raw output, it's from logging in and then I try to send
the message "hello" to a user, which isn't receiving it, I made a
comment above the message that isn't being delivered:

[code]
<body rid='2072917335' xmlns='http://nippon2/httpbind' to='nippon2'
xml:lang='en' wait='60' hold='1' window='5' content='text/xml;
charset=utf-8' ver='1.6' xmpp:version='1.0'
xmlns:xmpp='urn:xmpp:xbosh'/>
<body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://
etherx.jabber.org/streams' authid='f046ad65' sid='f046ad65'
secure='true' requests='2' inactivity='30' polling='5' wait='60'
hold='1' ack='2072917335' maxpause='300' ver='1.6'>
<stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>JIVE-SHAREDSECRET</mechanism>
<mechanism>PLAIN</mechanism>
<mechanism>ANONYMOUS</mechanism>
</mechanisms>
<compression xmlns='http://jabber.org/features/compress'>
<method>zlib</method>
</compression>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</stream:features>
</body>

<body rid='2072917336' xmlns='http://nippon2/httpbind' sid='f046ad65'>
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='PLAIN'>Ym9iYnlAbmlwcG9uMgBib2JieQBDYWxpZ3VsYQ==</auth>
</body>

<body xmlns='http://jabber.org/protocol/httpbind'>
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
</body>

<body rid='2072917337' xmlns='http://nippon2/httpbind' sid='f046ad65'
to='nippon2' xml:lang='en' xmpp:restart='true'
xmlns:xmpp='urn:xmpp:xbosh'/>

<body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://
etherx.jabber.org/streams'>
<stream:features>
<compression xmlns='http://jabber.org/features/compress'>
<method>zlib</method>
</compression>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</stream:features>
</body>

<body rid='2072917338' xmlns='http://nippon2/httpbind' sid='f046ad65'>
<iq type='set' id='_bind_auth_2'><bind
xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>
</body>

<body xmlns='http://jabber.org/protocol/httpbind'>
<iq type='result' id='_bind_auth_2' to='nippon2/f046ad65'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>user2@nippon2/f046ad65</jid>
</bind>
</iq>
</body>

<body rid='2072917339' xmlns='http://nippon2/httpbind' sid='f046ad65'>
<iq type='set' id='_session_auth_2'>
<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>
</body>

<body xmlns='http://jabber.org/protocol/httpbind'>
<iq type='result' id='_session_auth_2' to='user2@nippon2/f046ad65'>
<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>
</body>

<body rid='2072917340' xmlns='http://nippon2/httpbind'
sid='f046ad65'><presence/></body>

<body xmlns='http://jabber.org/protocol/httpbind'>
<presence from='user1@nippon2/MacDaniel' to='user2@nippon2/f046ad65'>
<priority>1</priority>
<c xmlns='http://jabber.org/protocol/caps' node='http://pidgin.im/
caps' ver='2.5.5devel' ext='mood moodn nick nickn tune tunen
avatarmeta avatardata buzz bob avatar adiumcmd'/>
<x xmlns='vcard-temp:x:update'>
<photo>939434931f9ba682f5fe019ec575fe59e0af9b48</photo>
</x>
</presence>
</body>

<body rid='2072917341' xmlns='http://nippon2/httpbind' sid='f046ad65'/
>

<body xmlns='http://jabber.org/protocol/httpbind'>
<message to='user2@nippon2/f046ad65' from='user1@nippon2'
id='user1@nippon2__user2@nippon2__69b3R'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='http://jabber.org/protocol/tune'>
<item id='03WR0Bsvqq8MGkJ'>
<tune xmlns='http://jabber.org/protocol/tune'/>
</item>
</items>
</event>
<x xmlns='jabber:x:delay' stamp='2009-02-25T09:22:05.368Z'/>
<addresses xmlns='http://jabber.org/protocol/address'>
<address type='replyto' jid='user1@nippon2/MacDaniel'/>
</addresses>
</message>
<message to='user2@nippon2/f046ad65' from='user3@nippon2'
id='user3@nippon2__user2@nippon2__t3Hw5'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='http://jabber.org/protocol/tune'>
<item id='qrScFi0Olb7UoH5'>
<tune xmlns='http://jabber.org/protocol/tune'/>
</item>
</items>
</event>
<x xmlns='jabber:x:delay' stamp='2009-02-23T16:11:26.098Z'/>
<addresses xmlns='http://jabber.org/protocol/address'>
<address type='replyto' jid='user3@nippon2/Home'/>
</addresses>
</message>
<iq type='get' id='purple714a44de' to='user2@nippon2/f046ad65'
from='user1@nippon2/MacDaniel'>
<query xmlns='jabber:iq:version'/>
</iq>
<iq type='get' id='purple714a44df' to='user2@nippon2/f046ad65'
from='user1@nippon2/MacDaniel'>
<query xmlns='jabber:iq:last'/>
</iq>
</body>

<body rid='2072917342' xmlns='http://nippon2/httpbind' sid='f046ad65'/
>

<body xmlns='http://jabber.org/protocol/httpbind'>
<message to='user2@nippon2/f046ad65' from='nippon2'>
<subject>Message of the Day</subject>
<body>Stay connected.</body>
</message>
</body>

<body rid='2072917343' xmlns='http://nippon2/httpbind' sid='f046ad65'/
>

<!-- this is the message not reaching the attended receiver -->
<body rid='2072917344' xmlns='http://nippon2/httpbind' sid='f046ad65'>
<message to='user1@nippon2' type='chat'>
<body>hello</body>
</message>
</body>
<body xmlns='http://jabber.org/protocol/httpbind' ack='2072917344'/>
[/code]

Jack Moffitt

unread,
Feb 25, 2009, 8:41:38 AM2/25/09
to str...@googlegroups.com
> This is the raw output, it's from logging in and then I try to send
> the message "hello" to a user, which isn't receiving it, I made a
> comment above the message that isn't being delivered:

Thanks for pretty printing the XML; that helped a ton with reading
through the log.

I don't see anything obvious in the log. Does it work if you send to
the full JID instead of the bare JID? Both should work of course.

Does openfire have enough logging that you could turn the verbosity up
and see what it is doing with your message? From the Strophe side I
can see that your message appears valid, and the BOSH connection
manager is also reporting that it was received. If the message is
getting lost, it is happening inside the connection manager or inside
the server.

The only thing that really sticks out to me is the use of "nippon2" as
the domain, although I assume the server must be handling that ok,
since it is delivering messages to you from another local user.

jack.

Daniel

unread,
Feb 25, 2009, 9:37:41 AM2/25/09
to Strophe
The domain name isn't actually just that, it has a domain attached to
it, I just removed it in the output. The actual webchat client and the
Openfire server isn't the same physical machine, could the http-bind
have an incorrect setup? Since it's working "one way" and not the
other.


This is the .htaccess file I have on the server running the webchat
(An apache2):

[code]
AddDefaultCharset UTF-8
Options +MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule http-bind/ http://nippon2.domain:7070/http-bind/
[P]
</IfModule>
[/code]

Changing between bare and full JID does nothing. Still works from
software client to webclient, not the other way round.

Matthew Wild

unread,
Feb 25, 2009, 9:47:17 AM2/25/09
to str...@googlegroups.com
On Wed, Feb 25, 2009 at 2:37 PM, Daniel <lindmar...@gmail.com> wrote:
>
> The domain name isn't actually just that, it has a domain attached to
> it, I just removed it in the output. The actual webchat client and the
> Openfire server isn't the same physical machine, could the http-bind
> have an incorrect setup? Since it's working "one way" and not the
> other.
>

Can you check that the message is definitely not received by the
client you are trying to send to (ie. in an XML console, etc.)? The
symptoms you have are the same as this issue which we've seen:
http://code.stanziq.com/strophe/ticket/32 (in which the receiver gets
incorrect XML, and doesn't display it as a message)

I haven't investigated yet, but I suspect whether it works or not is
dependant on the connection manager used (in your case Openfire, which
I've never tested with) and the receiving software client.

Matthew.

Daniel

unread,
Feb 25, 2009, 10:17:49 AM2/25/09
to Strophe
yeah that was the case, the message is actually sent, I changed to a
client with a xml console, and there I see the messages that I'm
sending from the web client.
Funny thing is, that when sending from that client, the messages isn't
delivered to the webclient.

On Feb 25, 3:47 pm, Matthew Wild <mwi...@gmail.com> wrote:
> On Wed, Feb 25, 2009 at 2:37 PM, Daniel <lindmark.dan...@gmail.com> wrote:
>
> > The domain name isn't actually just that, it has a domain attached to
> > it, I just removed it in the output. The actual webchat client and the
> > Openfire server isn't the same physical machine, could the http-bind
> > have an incorrect setup? Since it's working "one way" and not the
> > other.
>
> Can you check that the message is definitely not received by the
> client you are trying to send to (ie. in an XML console, etc.)? The
> symptoms you have are the same as this issue which we've seen:http://code.stanziq.com/strophe/ticket/32(in which the receiver gets

Daniel

unread,
Feb 25, 2009, 11:10:09 AM2/25/09
to Strophe
scratch that last remark, I can send message between software client
and webclient just like before.

On Feb 25, 4:17 pm, Daniel <lindmark.dan...@gmail.com> wrote:
> yeah that was the case, the message is actually sent, I changed to a
> client with a xml console, and there I see the messages that I'm
> sending from the web client.
> Funny thing is, that when sending from that client, the messages isn't
> delivered to the webclient.
>
> On Feb 25, 3:47 pm, Matthew Wild <mwi...@gmail.com> wrote:
>
>
>
> > On Wed, Feb 25, 2009 at 2:37 PM, Daniel <lindmark.dan...@gmail.com> wrote:
>
> > > The domain name isn't actually just that, it has a domain attached to
> > > it, I just removed it in the output. The actual webchat client and the
> > > Openfire server isn't the same physical machine, could the http-bind
> > > have an incorrect setup? Since it's working "one way" and not the
> > > other.
>
> > Can you check that the message is definitely not received by the
> > client you are trying to send to (ie. in an XML console, etc.)? The
> > symptoms you have are the same as this issue which we've seen:http://code.stanziq.com/strophe/ticket/32(inwhich the receiver gets

Matthew Wild

unread,
Feb 26, 2009, 10:40:04 AM2/26/09
to str...@googlegroups.com
Hi,

On Wed, Feb 25, 2009 at 4:10 PM, Daniel <lindmar...@gmail.com> wrote:
>
> scratch that last remark, I can send message between software client
> and webclient just like before.
>

I've attached a patch against the current git HEAD to the ticket at
http://code.stanziq.com/strophe/ticket/32 - let me know if it fixes
the problem for you. It appears to here.

Matthew.

Daniel

unread,
Feb 27, 2009, 2:44:06 AM2/27/09
to Strophe
That sure did it, now it all works like a charm.
Thank you so much!

/Daniel

On Feb 26, 4:40 pm, Matthew Wild <mwi...@gmail.com> wrote:
> Hi,
>
> On Wed, Feb 25, 2009 at 4:10 PM, Daniel <lindmark.dan...@gmail.com> wrote:
>
> > scratch that last remark, I can send message between software client
> > and webclient just like before.
>
> I've attached a patch against the current git HEAD to the ticket athttp://code.stanziq.com/strophe/ticket/32- let me know if it fixes
Reply all
Reply to author
Forward
0 new messages