Project

General

Profile

Messages sent by a component to an XMPP offline user

Luca Stucchi
Added about 4 years ago

Hi there,

I have a nice component that, at a certain time, sends an XMPP message to an user. While I was testing on PSI with online users, it worked like a charm, the user got a message from component@domain.com and everything looked fine.

If the user is offline, instead, I get a 404 error like the one below

2014-12-22 17:06:22.521 [in_0-message-router]  MessageRouter.processPacket()  FINEST:   Processing packet: from=null, to=null, DATA=<message xmlns="jabber:client" from="admin@domain.net/Smack" type="error" to="mycomponent@domain.net"><body>my message</body><action xmlns="http://www.domain.com/extensions/message#action" type="my action" id="u1lkX-8"/><error code="404" type="wait"><recipient-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">The recipient is no longer available.</text></error></message>, SIZE=453, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=error

I suspect that I have to insert a particular recipient to deliver at packet-level, but I couldn't find any indication of that... it just seems strange that having from=null, to=null can be correct !

Can this be related to the non-delivered messages to offline recipients ?

Thanks in advance,

Luca


Replies (4)

Added by Wojciech Kapcia TigaseTeam about 4 years ago

Given that you address your message to FullJID (i.e. admin@domain.net/Smack@) and most likely you do not set the type, and [RFC1621](http://xmpp.org/rfcs/rfc6121.html#rules-localpart-fulljid) states that only messages of type @chat should be stored for offline delivery.

Added by Luca Stucchi about 4 years ago

Thanks Wojciech,

I was making some tests right now and I discovered the setting type to chat it worked... looking for the error code that I got I saw that it stripped out the resource, so that's what I was testing a minute before you answered me. And now I even know why !

To me, as far as I get the messages, I have no problem in stripping resource away ! Do you see any possible drawback of this ?

All the best,

Luca

Added by Wojciech Kapcia TigaseTeam about 4 years ago

Everything depends on your requirements. RFC defines processing for both BareJID and JID, if you don't require sending message to exact resource then it would be preferable to send messages to BareJID.

Added by Luca Stucchi about 4 years ago

Considering everything, I think using BareJID is the best choice !

Thanks again

Luca

    (1-4/4)