[jdev] Stream Initiation: extension

Mats Bengtsson matben at privat.utfors.se
Fri Sep 28 07:05:43 CDT 2007

More thoughts:

Somewhat based on XHTML Inband Images 
I have come up with another suggestion.

Define an URI form xmpp:mats at home.se/coci?sipub=pub0123
which defines a unique resource identifier to a file or other entity.
A client, the initiator, can include this in any appropriate place, 
for instance, in a SVG image element (seen from the initiator side):

<message to='mari at mus.se/work' type='chat'>
  <x xmlns='http://jabber.org/protocol/svgwb'>
    <image x='32.0' y='32.0' 
           xlink:href='xmpp:mats at home.se/coci?sipub=pub0123' 
           id='158229644' width='128' height='128'>
      <file xmlns='http://jabber.org/protocol/si/profile/file-transfer' 
            name='blender.png' size='12582'/>

The initiator then caches the mapping from the sipub identifier (pub0123)
to the actual file or entity. The target can then request this file using:

<iq type='get' from='mari at mus.se/work' to='mats at home.se/coci' id='3210'>
   <sipub xmlns='http://jabber.org/protocol/si-pub' id='pub0123'/>

The initiator then looks up the second id here, the sipub id attribute,
and if it indeed has a file reference cached for this id, it initiates an
ordinary si-set/si query after sending a result:

<iq type='result' to='mari at mus.se/work' id='3210'>
  <sipub xmlns='http://jabber.org/protocol/si-pub' 
         id='pub0123' sid='3c803c10-6983032b'/>

Note that a sid attribute MUST be included which references the si id attribute
to expect when the target receives the iq-set/si query. The target must be sure
to understand that when it gets the corresponding iq-set/si it must not
be handled as an ordinary user initiated file transfer.

Everything continues unchanged from existing Stream Initiation. If the initiator 
can't find the sipub id reference it answers with an error as usual.
Note that this XMPP URI is persistant since each request for it generates
a new si stream. The si streams are, of course, not persistant, but the
reference from the sipub identifier to the actual file or entity is.
It is up to the initiating entity to decide on the lifetime of this relation. 

There is a slightly alternative solution. The initiators iq-set/si must be
handled in the context of the original XMPP URI which the iq-set/si element
doesn't say anything about. It can therefore be mistaken as an ordinary 
user initiated file transfer. Instead we could switch the 

<si xmlns='http://jabber.org/protocol/si' ...


<sipub xmlns='http://jabber.org/protocol/si-pub' ...

in all places. I have some doubts about this, though. It complicates the
life of a client developer.


More information about the JDev mailing list