JEP-0084: user avatar jabber user profile agreement

Source: Internet
Author: User
Tags vcard
The user profile picture is called "Avatar" in jabber, And the JEP-0084 defines a method that complies with the XMPP protocol to transmit profile picture information, the Protocol is built on the personal eventing via pubsub [2] subset ("pep") of pubsub. In addition, the Avatar avatar can also be stored using vCard, for example, PSI uses vCard.
There are currently fewer clients using the JEP-0084.

In addition, there is also an old Avatar protocol JEP-0008: IQ-based avatars, Pandion is currently using the obsolete protocol.

The JEP-0084 uses two nodes to save Avatar information, the State (metadata node), and the image content (data node ). After the user updates the Avatar data (data node), the metadata node content is updated at the same time (equivalent to the Content Index). The subscribed user only needs to subscribe to the metadata node, the content of the data node is updated only after the metadata node detects an update. This prevents the user from generating a large amount of data traffic each time the data node is queried.

Avatar usage process:
1. Create a metadata node.
Send: <IQ type = 'set' from = 'timyang @ jabber.org/chamber' id = 'create1 '>
<Pubsub xmlns = 'HTTP: // jabber.org/protocol/pubsub'>
<Create node = 'HTTP: // jabber.org/protocol/avatar#metadata'/>
<Configure>
<X xmlns = 'jabber: X: data' type = 'form'>
<Field Var = 'form _ type' type = 'den den '>
<Value> http://jabber.org/protocol/pubsub#node_config </value>
</Field>
<Field Var = 'pubsub # access_model '>
<Option> <value> presence </value> </option>
</Field>
</X>
</Configure>
</Pubsub>
</IQ>
Nodeid must be "http://jabber.org/protocol/avatar#metadata" access method should be "presence ".
<IQ type = 'result' to = 'timyang @ jabber.org/chamber' id = 'create1 '/>

2. Create a Data Node
Create a data node of the "image/PNG" Type"
The user creates a data node, which must be a http://jabber.org/protocol/avatar#data
<IQ type = 'set' from = 'timyang @ jabber.org/chamber' id = 'create2'>
<Pubsub xmlns = 'HTTP: // jabber.org/protocol/pubsub'>
<Create node = 'HTTP: // jabber.org/protocol/avatar#data'/>
<Configure/>
</Pubsub>
</IQ>
<IQ type = 'result' to = 'timyang @ jabber.org/chamber' id = 'create2'/>

3. Publish Images
The user publishes image/PNG Image Information to the data node and submits images of other formats in http url format.
<IQ type = 'set' from = 'timyang @ jabber.org/chamber' id = 'h1 H1 '>
<Pubsub xmlns = 'HTTP: // jabber.org/protocol/pubsub'>
<Publish node = 'HTTP: // jabber.org/protocol/avatar#data'>
<Item id = '111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<Data xmlns = 'HTTP: // jabber.org/protocol/avatar#data'>
Qanqr1dbwu4dx7jmyznncm...
</Data>
</Item>
<Item id = '222f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<Data xmlns = 'HTTP: // jabber.org/protocol/avatar#data'>
Http://qqshow.qq.com/12345/my.swf
</Data>
</Item>
</Publish>
</Pubsub>
</IQ>
<IQ type = 'result' to = 'timyang @ jabber.org/chamber' id = 'h1 H1 '/>

4. Publish image Indexes
The Avatar index information is sent to the meta data node, and the item ID is set to the hash value of the image file, so that other subscription users can compare whether the image changes.
The user sets the Avatar to use several fixed files in turn, so that another subscribed user can cache the image, so that the image does not need to be re-downloaded every update.
<IQ type = 'set' from = 'timyang @ jabber.org/chamber' id = 'h2 H2 '>
<Pubsub xmlns = 'HTTP: // jabber.org/protocol/pubsub'>
<Publish node = 'HTTP: // jabber.org/protocol/avatar#metadata'>
<Item id = '111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<Metadata xmlns = 'HTTP: // jabber.org/protocol/avatar#metadata'>
<Info id = '111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
Type = 'image/PNG'
Bytes = '000000'
Height = '64'
Width = '64'/>
</Metadata>
</Item>
</Publish>
</Pubsub>
</IQ>

5. The Subscriber (the user's friend) obtains the message.
<Message to = 'Romeo @ montague.net 'from = 'timyang @ jabber.org'>
<Event xmlns = 'HTTP: // jabber.org/protocol/pubsub#event'>
<Items node = 'HTTP: // jabber.org/protocol/avatar#metadata'>
<Item id = '111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<Metadata xmlns = 'HTTP: // jabber.org/protocol/avatar#metadata'>
<Info id = '111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
Type = 'image/PNG'
Bytes = '000000'
Height = '64'
Width = '64'/>
</Metadata>
</Item>
</Items>
</Event>
<Addresses xmlns = 'HTTP: // jabber.org/protocol/address'>
<Address type = 'replyto 'jid = 'timyang @ jabber.org/chamber'/>
</Addresses>
</Message>

6. If necessary, the subscriber obtains the image content

<IQ type = 'get'
From = 'Romeo @ montague.net/home'
To = 'timyang @ jabber.org'
Id = 'retrieve1 '>
<Pubsub xmlns = 'HTTP: // jabber.org/protocol/pubsub'>
<Items node = 'HTTP: // jabber.org/protocol/avatar#data'>
<Item id = '111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
</Items>
</Pubsub>
</IQ>

When the server returns the result, it is not returned by the client. The idea of P2P in Jep is still too small.

<IQ type = 'result' from = 'timyang @ jabber.org 'To = 'Romeo @ montague.net/home' id = 'h1 H1'>
<Pubsub xmlns = 'HTTP: // jabber.org/protocol/pubsub'>
<Publish node = 'HTTP: // jabber.org/protocol/avatar#data'>
<Item id = '111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<Data xmlns = 'HTTP: // jabber.org/protocol/avatar#data'>
Qanqr1dbwu4dx7jmyznncm...
</Data>
</Item>
</Publish>
</Pubsub>
</IQ>

7. Optional. You can also set the client to not Display User portraits.
Use stop label
<IQ type = 'set' from = 'timyang @ jabber.org/chamber' id = 'h3 H3 '>
<Pubsub xmlns = 'HTTP: // jabber.org/protocol/pubsub'>
<Publish node = 'Avatar/INFO/timyang@jabber.org '>
<Item>
<Metadata xmlns = 'HTTP: // jabber.org/protocol/avatar#metadata'>
<Stop/>
</Metadata>
</Item>
</Publish>
</Pubsub>
</IQ>

As before, subscribers to the metadata node wocould then receive the notification:

Example 12. subscribers receive Avatar metadata notification

<Message to = 'Romeo @ montague.net 'from = 'timyang @ jabber.org'>
<Event xmlns = 'HTTP: // jabber.org/protocol/pubsub#event'>
<Items node = 'HTTP: // jabber.org/protocol/avatar#metadata'>
<Item>
<Metadata xmlns = 'HTTP: // jabber.org/protocol/avatar#metadata'>
<Stop/>
</Metadata>
</Item>
</Items>
</Event>
<Addresses xmlns = 'HTTP: // jabber.org/protocol/address'>
<Address type = 'replyto 'jid = 'timyang @ jabber.org/chamber'/>
</Addresses>
</Message>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.