[jdev] JEP-0138: Stream Compression

Stephen Pendleton spendleton at movsoftware.com
Thu Mar 10 10:48:14 CST 2005


After reading through the JEP-0138, I would like to submit some ideas on
this to the jdev community.  As was mentioned before on the list many mobile
clients have limited processing and/or memory requirements that may preclude
the use of zlib at certain compression levels. For example, zlib compression
at level 3 may perform well on a typical cellphone, but level 9 may produce
unacceptable performance. It seems to me that this would be a excellent use
case of JEP-0020 (feature negotiation) to find out what compression levels
and/or methods (zlib, bzip, foozip, etc) are supported on the endpoints.

A sample session is described below:

CLIENT (query server for features):
<iq
    type='get'
    from='juliet at capulet.com/imov'
    to='movcast.movsoftware.com'
    id='neg1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

SERVER (sends back a negotiable feature list):
<iq
    type='result'
    from='movcast.movsoftware.com'
    to='juliet at capulet.com/imov'
    id='neg1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='http://jabber.org/protocol/feature-neg'/>
    <feature var='zlib-compression-level'/>
    ...
  </query>
</iq>

CLIENT (asks to negotiate zlib type compression):
<iq
    type='get'
    from='juliet at capulet.com/imov'
    to='movcast.movsoftware.com'
    id='neg2'>
  <query xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='zlib-compression-level'/>
    </x>
  </query>
</iq>

SERVER (server supports both levels 1 and 2 of the zlib compression
protocol):
<iq
    type='result'
    from='movcast.movsoftware.com'
    to='juliet at capulet.com/imov'
    id='neg2'>
  <query xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='result'>
      <field var='zlib-compression-level' type='form'>
        <option><value>1</value></option>
        <option><value>2</value></option>
      </field>
    </x>
  </query>
</iq>


CLIENT (the client selects level 2 of zlib compression):
<iq type="result" id="1" to='movcast.movsoftware.com'>
  <query xmlns="http://jabber.org/protocol/feature-neg">
    <x xmlns="jabber:x:data">
      <field var='zlib-compression-level'>
        <value>2</value>
      </field>    
    </x>
  </query>
</iq>

CLIENT (the client must now initiate a new stream using the new compression)
<stream:stream
    xmlns='jabber:client'
    xmlns:stream='http://etherx.jabber.org/streams'
    to='movcast.movsoftware.com'>

Any feedback on this scheme would be welcome.





More information about the JDev mailing list