Peter Saint-Andre wrote:
Joe Hildebrand wrote:

On Jan 18, 2008, at 3:25 PM, Peter Saint-Andre wrote:
Sure, clients could send an iq:version request once upon receiving caps for a given node+ver+v from a given JID, then cache that across sessions. But I can hear the complaints coming already: "I develop a web/mobile/whatever client and I can't cache across sessions so I'll have to send iq:version requests every time". And I think this objection will be common enough that we might as well include n='client' (probably about an extra 10 bytes on average) in every presence stanza.

Perhaps I didn't show enough of my work. The idea is that if you cache on node+ver+v, you'll disco#info the same number of times as in version 1.4, and get the exact same identity data. No need for n=, no need for iq:version requests.

Correct. So:

1. If you cache across sessions, you will send exactly one iq:version request (ever) for each combination of node+ver+v.

2. If you don't cache across sessions, you'll send exactly one iq:version request per session for each node+ver+v.

3. If you don't cache within a session, you'll send as one iq:version request for every incoming presence notification.

Ah Joe and I chatted IRL and he set me straight. You never need to send an iq:version request, because you can get the software name via disco (internationalized if necessary) and you have the version via caps.

So let's say you receive presence with caps for a given node+ver+v you've never seen before:

<presence from='[EMAIL PROTECTED]/globe'>
  <c xmlns='http://jabber.org/protocol/caps'
     hash='sha-1'
     node='http://www.chatopus.com'
     v='2.1'
     ver='zHyEOgxTrkpSdGcQKH8EFPLsriY='/>
</presence>

So you send a disco#info request:

<iq type='get'
    from='[EMAIL PROTECTED]/orchard'
    to='[EMAIL PROTECTED]/globe'
    id='info1'
    xml:lang='en'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

And you receive a reply:

<iq type='result'
    from='[EMAIL PROTECTED]/globe'
    to='[EMAIL PROTECTED]/orchard'
    id='info1'
    xml:lang='en'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <identity
        category='client'
        type='pda'
        name='Chatopus'/>
    <feature var='http://jabber.org/protocol/disco#info'/>
    <feature var='http://jabber.org/protocol/disco#items'/>
    <feature var='http://jabber.org/protocol/muc'/>
    <feature var='jabber:iq:time'/>
    <feature var='jabber:iq:version'/>
  </query>
</iq>

Now you know that node='http://www.chatopus.com' and v='2.1' and ver='zHyEOgxTrkpSdGcQKH8EFPLsriY=' means a software product name of "Chatopus" for xml:lang='en' (but for some other language the name could be different!). So you cache that across sessions and you never need to send a disco#info or iq:version request to an entity that provides that combination of node+v+ver in caps.

To do this we need to include node and v in caps, but we're going to include node anyway (for backwards-compatibility). So the question is whether including 'v' is worth the extra 5 or 10 bytes in each presence notification.

Peter

--
Peter Saint-Andre
https://stpeter.im/

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to