pubsub地址:https://xmpp.org/extensions/xep-0060.html

创建pubsub节点

1
2
3
4
5
<iq type='set' from='00000032@im.com/swm-mac' to='pubsub.im.com' id='create1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<create node='story tell'/> # story tell 为节点名称
</pubsub>
</iq>

订阅节点

1
2
3
4
5
<iq type='set' from='00000010@im.com' to='pubsub.im.com' id='sub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe node='story tell' jid='00000010@im.com'/> #订阅story tell节点
</pubsub>
</iq>

所有者查看订阅人员

1
2
3
4
5
<iq type='get' from='12345677@im.com/elsinore' to='pubsub.im.com' id='subman1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
<subscriptions node='story tell'/>
</pubsub>
</iq>

查询某个pubsub的订阅者

1
2
3
4
5
<iq type='get' from='00000011@im.com' to='pubsub.im.com' id='subscriptions2'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscriptions node='story tell'/>
</pubsub>
</iq>

向节点内发送消息

1
2
3
4
5
6
7
8
9
<iq type ="set" from ="00000010@im.com" to="pubsub.im.com" id="publish1">
<pubsub xmlns ="http://jabber.org/protocol/pubsub">
<publish node ="story tell">
<item id="bnd81g37d61f49fgn581">
<presence xmlns='http://yfaf.com/xmpp-ext/persence' jid="00000010@im.com">20</presence>
</item>
</publish>
</pubsub>
</iq>

删除订阅的节点

1
2
3
4
5
<iq type ='set'from ='12345678_yf.com@im.com/elsinore' to ='pubsub.im.com' id ='delete1 '>
<pubsub xmlns ='http://jabber.org/protocol/pubsub#owner'>
<delete node ='story tell'/ >
</ pubsub >
</iq >

最后更新: 2019年07月06日 16:45

原始链接: https://chenadminchen.github.io/2017/12/25/tigase-pubsub/

× 请我吃糖~
打赏二维码