You are here

sipub + SVG = true!

That cryptic title means: Stream Initiation using Publish Subscribe and Scalable Vector Graphics are living well together. That didn't made you any wiser, did it? The long story then.

Several efforts have been made to add a whiteboarding protocol to XMPP based on SVG, which is the web standard for 2D graphics, but a dynamic environment like XMPP is very far from a static web situation. In particular, there are synchronization issues and a few other things. One of the other things is that image entities are referenced using a HTTP link, and that wont work well for clients which normally live behind NATs and firewalls etc.

XMPP specifies a number of file transfer protocols (si, ibb, ftrans, bytestreams) and a runner up is something based on jingle using UDP instead of TCP. The problem with all these standard file transfer protocols is that they assume that files are pushed to users, instead of being pulled (or GET) which is the situation on the web. The sipub protocol is a variant where users can "pull", or "get" a file, just as getting a HTTP link.

It turned out that it was pretty straightforward to add it to my Coccinella SVG protocol. In a whiteboard chat session, if a user opens an image the following stanza is sent:

<message to='mats2@jabber.se/z' type='chat'>
  <thread>768681</thread>
  <x xmlns='http://jabber.org/protocol/svgwb'>
    <image x='80.0' y='80.0' 
        xlink:href='http://../antivirus.png' 
        id='111958708' width='32' height='32'>
      <sipub xmlns='http://jabber.org/protocol/si-pub' 
          from='mari@jabber.se/x' 
          id='1a3b2315-9ec6bdc' 
          mime-type='image/png' 
          profile='http://jabber.org/protocol/si/profile/file-transfer'>
        <file xmlns='http://jabber.org/protocol/si/profile/file-transfer' 
              name='antivirus.png' 
              size='2074'/>
      </sipub>
    </image>
  </x>
</message>

which is just an ordinary SVG image, but with a sipub element as a child. The HTTP link can be used for something else, or just ignored. A variant could be to use the XMPP URI "recvfile" syntax but I see no need to have another syntax when we already have the xml elements.

This is now implemented in the cvs version but must be switched on by some command line arguments. I should say that this is only made for the SVG image element, but I see no particular problem to use it also for foreignObject elements, or any other elements which reference an external entity. Also implemented is the XMPP "recvfile" URi syntax, but it is unclear how useful it is.