Google Talk has implemented XMPP (jabber portocol) but has it implemented XEP-0079 too?
XEP-0079 is an XMPP extention about "Advanced Message Processing".
No.
We can use XEP-0030 (Service Discovery) to ask the server at talk.google.com what it features it provides.
XEP-0079 specifies a <feature> of http://jabber.org/protocol/amp but, as we can see from the request/response below, the gmail.com service does not include this feature in its response.
<iq to='gmail.com' type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
<iq xmlns='jabber:client' from='gmail.com' type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity category='server' type='im' name='Google Talk'/>
<feature var='http://jabber.org/protocol/disco#info'/>
<feature var='google:jingleinfo'/>
<feature var='google:roster'/>
<feature var='google:nosave'/>
<feature var='google:setting'/>
<feature var='google:shared-status'/>
<feature var='http://jabber.org/protocol/archive#otr'/>
<feature var='google:mail:notify'/>
<feature var='http://jabber.org/protocol/archive#save'/>
<feature var='http://jabber.org/protocol/rosterx'/>
</query>
</iq>
To amplify Christopher's answer, not only does Google not implement AMP, there are few others who do, since it doesn't solve enough of the problem. For something hop-by-hop, consider XEP-0198: Stream Management, which also provides quick reconnect.
Related
I'm creating a chat app using the Electron Framework and node-xmpp module for XMPP communication.
I have managed to do almost everything except making Personal Eventing Protocol to work. Specifically sending a new nickname to the roster.
When I send the PEP stanza
<iq from='test#localhost' type='set' id='pub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='http://jabber.org/protocol/nick'>
<item>
<nick xmlns='http://jabber.org/protocol/nick'>I am a test user</nick>
</item>
</publish>
</pubsub>
</iq>
I get a response IQ stanza:
<iq from="test#localhost" type="result" to="test#localhost/testapp" id="pub1">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="http://jabber.org/protocol/nick">
<item id="5D4E0BB8EB3C6"/>
</publish>
</pubsub>
</iq>
Now, according to XEP-172 example 6 I should get a Message with the nickname that is also sent to all my contacts. It should look like this:
<message from='test#localhost' to='otheruser#localhost' type='headline' id='foo'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='http://jabber.org/protocol/nick'>
<item>
<nick xmlns='http://jabber.org/protocol/nick'>I am a test user</nick>
</item>
</items>
</event>
<addresses xmlns='http://jabber.org/protocol/address'>
<address type='replyto' jid='test#localhost/chatapp'/>
</addresses>
</message>
The thing is I'm not getting any message to other contacts in the user's roster. Not even to myself.
Is there any step I'm missing to enable PEP on a ejabberd server? Any extra stanza or information I should include?
Thanks!
If you want to receive other users' nickname events you should include http://jabber.org/protocol/nick+notify string into your Entity Capabilities list.
See Filtered notifications for detailed description.
I'm using an XMPP server that implements XEP-0313 for retrieving conversation history. I would like to fetch only the last message of each conversation, so that I can build a list of your most recent conversations previewing the last message.
I've managed to fetch all messages of all conversations and based on that I could build the list, but it's a big waste of data and not an option. I'm not sure this is the right extension for accomplishing this, so if there is another extension I should be looking at, please guide me in the right direction.
One thing you can do easily is first retrieve the user's roster and then for each contact retrieve the latest message.
<iq from='juliet#example.com/balcony'
id='bv1bs71f'
type='get'>
<query xmlns='jabber:iq:roster'/>
</iq>
Result:
<iq id='bv1bs71f'
to='juliet#example.com/chamber'
type='result'>
<query xmlns='jabber:iq:roster' ver='ver7'>
<item jid='nurse#example.com'/>
<item jid='romeo#example.net'/>
</query>
</iq>
Retrieve the last message from or to nurse#example.com:
<iq type='set' id='juliet1'>
<query xmlns='urn:xmpp:mam:1'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:mam:1</value>
</field>
<field var='with'>
<value>nurse#example.com</value>
</field>
</x>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>1</max>
<before/>
</set>
</query>
</iq>
Of course users can have conversations with people not on their roster, but in practice this is quite rare on XMPP.
I’m using Openfire XMPP server for a android chat application. I can connect and login to the server using my app.
Now I want to know how to send friend request and accept friend request in this chat application.
I can fetch all the user from server but I want to know the process of starting a chat.
Thanks in advance.
The processes are a bit more complex than it looks to add/accept friend requests you need to do some juggling with presence and and roster iq stanzas.
I'll try to give you an indication about what stanzas are sent/received using contacts operations below.
1. Add contact
To add a contact you need to send a `subscribe` stanza.
<presence xmlns="jabber:client" to="you#app.com/123" id="9VO8j-1" type="subscribe" from="me#app.com/1234" />
1.1. Request accepted
When adding a contact and the other app "accepts the request" you receive two stanzas:
1. <presence xmlns="jabber:client" from="you#app.com/123" id="9VO8j-1" type="subscribed" to="me#app.com/1234" />
2. <presence xmlns="jabber:client" from="you#app.com/123" id="9VO8j-2" type="subscribe" to="me#app.com/1234" />
3. <presence xmlns="jabber:client" from="me#app.com/1234" id="9VO8j-3" type="subscribed" to="you#app.com/123" />
1.2. Request Denied
When the request is denied you receive an "UNSUBSCRIBED" stanza.
Example: <presence xmlns="jabber:client" from="you#app.com/123" id="9VO8j-1" type="unsubscribed" to="me#app.com/1234" />
2. Accept contact request
1. <presence xmlns="jabber:client" from="me#app.com/1234" id="9VO8j-1" type="subscribed" to="you#app.com/123" />
2. <presence xmlns="jabber:client" from="me#app.com/1234" id="9VO8j-2" type="subscribe" to="you#app.com/123" />
3. Deny contact request
<presence xmlns="jabber:client" from="me#app.com/1234" id="9VO8j-1" type="unsubscribed" to="you#app.com/123" />
4. Remove contact
When you "Delete" a contact you should be in fact be "deleting" it locally in your app and from the roster.
This is done by sending two stanzas:
1. <presence xmlns="jabber:client" from="me#app.com/1234" id="9VO8j-3" type="unsubscribe" to="you#app.com/123"/>
2. <iq from='me#app.com/1234' id='ah382g67' to='you#app.com/123' type='set'>
<query xmlns='jabber:iq:roster' ver='ver34'>
<item jid='you#app.com/123' subscription='remove'/>
</query>
</iq>
Note: The use-cases described above do not include all the iq:roster stanzas associated to the presence stanzas. These are sent automatically by the server whenever a contact changes the subscription and ask types.
For a better understanding of how the these workflows work in details I suggest you read the latest RFC (implemented by your server). You can find it on the office site.
See section 3. Managing the roster.
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.
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>