I have an XMPP chat client using wokkel and twisted and it works fine, but when a user comes online, I send this stanza to get the messages a user received while offline:
<iq type='get' id='fetch1'><offline xmlns='http://jabber.org/protocol/offline'><fetch/></offline></iq>
Other messages send and receive just fine but this stanza never returns anything. Any ideas how to debug or what the issue is? (These are google talk users)
Update: Google talk in theory supports XEP-0136 (archiving). When you get a list of support features you get:
<feature var='http://jabber.org/protocol/archive#otr'/>
<feature var='http://jabber.org/protocol/archive#save'/>
However, when I then follow this: http://xmpp.org/extensions/xep-0136.html#manage-retrieve
as to how to retrieve archived messages. I send the following stanza:
<iq type='get' id='page1'><retrieve xmlns='urn:xmpp:archive'/></iq>
[Whether or not I include the tag part of their example, I get a feature not support error back from Google's XMPP server]
<iq xmlns='jabber:client' to='x#gmail.com/7EBA7137' type='error' id='page1'>
<retrieve xmlns='urn:xmpp:archive'/><error code='501' type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
Related
For example, I have 20 rooms to join. The simple solution is to send 20 message to each room id. Considering the performance, this is bad.
I want to join the 20 rooms by just sending one <presence> message, how to achieve this? Writing a module to hook the custom <presence> message? But I do not know how to write this kind of module.
In XEP-0045 Multi User Chat, there is no way defined to join 20 chat rooms with a single presence packet.
However, by combining other XMPP Extension with Multi User Chat, you can definitely achieve this in pure XMPP, without the need to write custom ejabberd extensions.
You can rely on XEP-0033 Extended Stanza Addressing, you can send an XMPP packet to several recipient. It also works with presence as shown in this example.
ejabberd configuration
XEP-0033 Extending Stanza Addressing is supported as default since ejabberd 15.04. Make sure you have enable the feature by adding mod_multicast in ejabberd configuration modules section:
modules:
...
mod_multicast: {}
When the service is enabled, you should have a new service (as default named multicast.example.net) on the server supporting the feature http://jabber.org/protocol/address:
<iq type='get'
to='multicast.example.net'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
and response is:
<iq from="multicast.example.net" type="result" to="test#example.net/laptop" id="info1">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="service" type="multicast" name="Multicast"/>
<feature var="http://jabber.org/protocol/disco#info"/>
<feature var="http://jabber.org/protocol/disco#items"/>
<feature var="vcard-temp"/>
<feature var="http://jabber.org/protocol/address"/>
</query>
</iq>
Usage
Once enabled, it is easy to send a presence packet targeting several MUC rooms:
<presence to='multicast.example.net'>
<addresses xmlns='http://jabber.org/protocol/address'>
<address type='bcc' jid='testroom#conference.example.net/Usernick'/>
<address type='bcc' jid='testroom2# conference.example.net/Usernick'/>
</addresses>
</presence>
You will thus see that you are joining several rooms at the same time.
Issues
XEP-0033 did not specifically mention that use case and the module had not been testing to join multiple rooms. While writing this example I found that when disconnecting, user does not properly leave the rooms he had joined.
It means you have to wait for the following Github issue to be fixed before the feature is usable in production: Broadcast presence change after multicast presence packet.
How can I retrieve items using PEP pubsub XMPP protocol? I don't know how to retrieve history of PEP events. I tried with this stanza, but I am getting an "item not found" error.
<iq type='get'
from='admin#domain.ddns.net'
to='pubsub.domain.ddns.net'
id='items1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='http://jabber.org/protocol/tune'/>
</pubsub>
</iq>
You're sending the request to pubsub.domain.ddns.net, i.e. a Pubsub service, but when using PEP, you need to send the requests to the bare JID of the contact, e.g. user#domain.ddns.net. See XEP-0163 for more details.
Im using Jabber-Net API to make a GMail client. I've been having problems with the subscription process using my client as it always returning the "subscription=none" and "ask=none". When i subscribe a new user, it works fine but, subscribing/ unsubscribing users very frquently from roster makes the users stop to send subscription request with "to/ from/ both" or etc.
I have discovered that, "CONTACT" always receives a packet like this:
<iq type="set">
<query xmlns="jabber:iq:roster">
<item
jid="jabberuser#host"
subscription="none"
ask="none"/>
</query>
</iq>
Any prompt answer will be much appreciated..
Are you sending a presence subscription?
<presence type='subscribe' to='jabberuser#host'/>
I'm creating custom xmpp chat application with use of Strophe.js. The communication between browser and desktop client (Adium) works perfectly. I can send messages via browser to Adium and from Adium to the browser. There is yet the problem with browser-browser communication at some point as messages are sent but not delivered. It seems it's just Google Chrome problem.
What's interesting is the fact that <presence> stanzas are sent and delivered fine. We use ejabberd as the server daemon.
This is the presence stanza I'm sending from one account:
<presence type="away" xmlns="jabber:client">
<show>away</show>
<status/>
</presence>
and what I receive on the other:
<presence xmlns="jabber:client" from="test1#domain.com/3917283126133167196759537" to="test2#domain.com/1563391996133167110798391" type="away">
<show>away</show>
<status/>
</presence>
also the message stanza I send:
<message from="test1#domain.com/267172122813316722921543" to="test2#domain.com" type="chat" id="4915" xmlns="jabber:client">
<active xmlns="http://jabber.org/protocol/chatstates" />
<body>Testing...</body>
</message>
and nothing is received on Chrome...
EDIT:
The problem was with escaping some characters. Chrome did not let them unescaped due to security issues.
The type="away" in your initial presence is not valid. Omit the 'type' attribute for available presence. Set type="unavailable" when you are going offline.
Because your presence is invalid you are not marked as available, and you will not receive any messages addressed to your bare JID.
Update: To clear any confusion about what I mean by the above (see comments)...
The 'type' attribute on this stanza is invalid:
<presence type="away" xmlns="jabber:client">
<show>away</show>
<status/>
</presence>
It is otherwise fine. There are two types of presence a client may send, available and unavailable. Standard available presence has no 'type' attribute. Unavailable presence has type="unavailable". The actual status of the user (away, etc.) is signaled via the <show/> and <status/> elements, not the 'type' attribute.
To make it the above stanza a valid available presence, just remove type="away":
<presence xmlns="jabber:client">
<show>away</show>
<status/>
</presence>
I am trying to find out the execution order of XMPP stanzas, I am using Strophe + Ejabberd and if I send a request like this.
<body rid='someRID' xmlns='http://jabber.org/protocol/httpbind' sid='someSID'>
<message to='someUser#someDomain' type='chat' xmlns='jabber:client'>
<body>123</body>
</message>
<presence type='unavailable' xmlns='jabber:client' />
</body>
Presence stanzas is always executed first and message stanza later. Is there a way to specify order or something like that so that Message stanza is executed first and Presence later.
Thanks
It's a bug in the server. RFC 6120, Section 10.1 says:
An XMPP server MUST ensure in-order processing of the stanzas and
other XML elements it receives over a given input stream from a
connected client or remote server.