List of clocks


Publish-Subscribe specification of XMPP

send/receive seen from client side

use smack nightly build with pubsub included!

SEND: get clocks


smack API:

PubSubManager manager = new PubSubManager(con, "pubsub.walls.okno.be");
Node eventNode = manager.getNode("clocks");

XMPP message sent:

<iq type="get"
	from="geraldo@walls.okno.be/tiks"
	to="pubsub.walls.okno.be"
	id="clocks">
	<query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>

RECEIVE: result clocks list

<iq type="result"
	from="pubsub.walls.okno.be"
	to="geraldo@walls.okno.be/tiks"
	id="clocks">
	<query xmlns='http://jabber.org/protocol/disco#items'>
    <item jid='pubsub.walls.okno.be'
          node='clock1'
          name='windclock 1 running at Bratislava'/>
    <item jid='pubsub.walls.okno.be'
          node='clock2'
          name='windclock 2 running at Brussels'/>
  </query>
</iq>

Subscribe to clock

SEND: subscribe


smack API:

eventNode.subscribe("geraldo@walls.okno.be");

XMPP message sent:

<iq type='set'
    from='geraldo@walls.okno.be/tiks'
    to='pubsub.walls.okno.be'
    id='sub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <subscribe
        node='clock1'
        jid='geraldo@walls.okno.be'/>
  </pubsub>
</iq>

RECEIVE: success

<iq type='result'
    from='pubsub.walls.okno.be'
    to='geraldo@walls.okno.be/tiks'
    id='sub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <subscription
        node='clock1'
        jid='geraldo@walls.okno.be'
        subid='ba49252aaa4f5d320c24d3766f0bdcade78c78d3'
        subscription='subscribed'/>
  </pubsub>
</iq>

RECEIVE: one of possible errors: node does not exist

<iq type='error'
    from='pubsub.walls.okno.be'
    to='geraldo@walls.okno.be/tiks'
    id='sub1'>
	<error type='cancel'>
    <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>

SEND: unsubscribe

<iq type='set'
    from='geraldo@walls.okno.be/tiks'
    to='pubsub.walls.okno.be'
    id='unsub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
     <unsubscribe
         node='clock1'
         jid='geraldo@walls.okno.be'/>
  </pubsub>
</iq>

Send tiks

TAK TO XMPP SERVER: publish tiks

<iq type='set'
    from='clock1@walls.okno.be/tiks'
    to='pubsub.walls.okno.be'
    id='pub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='clock1'>
      <item>
        [ ... ENTRY ... ]
      </item>
    </publish>
  </pubsub>
</iq>

RECEIVE: message sent to subscribers

<message from='pubsub.walls.okno.be' to='geraldo@walls.okno.be' id='msg'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='clock1'>
      <item id='ae890ac52d0df67ed7cfdf51b644e901'>
        <entry xmlns='http://json.org/'>
        {"id_clock": 1, "tiks": 7434}
        </entry>
      </item>
    </items>
  </event>
</message>
 
windclocks/xmpp.txt · Last modified: 2011/01/26 14:13 by geraldo
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki