Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
notizklotz #1
Member since Dec 2005 · 10 posts · Location: Switzerland
Group memberships: Members
Show profile · Link to this post
Subject: Publish-Subscribe (JEP-0060) code for simple use cases
For a project I'm currently on I fiddled around with the Publish-Subscribe extension for Jabber (http://www.jabber.org/jeps/jep-0060.html). I wrote some code to cover the most basic use cases:

  • subscribing to an existing node
  • creating a new node on the server
  • publishing something to a node
  • requesting information about a node
  • requesting the default node configuration
  • requesting information about all affiliations of the user
  • requesting all items of a node


The code is a bit rough around the edges as I was just prototyping but it does the job. There's a factory which even hides the complexity of putting DOM elements together. The following code demonstrates how to create, subscribe and publish to a node whereas the xmppClientConnection variable is a placeholder for an XmppClientConnection instance:

  1. xmppClientConnection.Send(PubsubElementFactory psubElementFactory = new PubsubElementFactory("pubsub.jabber.org", xmppClientConnection.MyJID));
  2. string testNodeName = "TestNode";
  3. xmppClientConnection.Send(psubElementFactory.CreateNode(testNodeName));
  4. xmppClientConnection.Send(psubElementFactory.Subscribe(testNodeName));
  5.  
  6. Element payload = new Element("myPubSubSuperTag");
  7. xmppClientConnection.Send(psubElementFactory.Publish(testNodeName, payload));

If anybody is interested in the code just drop me a message!

By the way, I used the  Wildfire Jabber Server and a snapshot of Idavoll2 as JEP-0060 component.
This post was edited on 2006-04-08, 23:12 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi notizklotz,

of course im interested, do you have a URL where i can download the code?

Alex
Avatar
d_mueck #3
Member since Apr 2006 · 6 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
Is there any documentation available on how to run a jabber server with pubsub support?
I've started to write my own pubsub service what in turn supports only those feature I require.
Running a server with full pubsub support would help a lot.
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

the eJabberd server includes a pubsub component. For all other servers you could use the idavoll component.
Jive and Coversant are both working hard on pubsub. So this servers will include a pubsub component with one of the next releases too.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Some pubsub news. Jive released a new version of the server including PubSub:
http://www.jivesoftware.org/community/entry.j…?externalI…

Alex
Avatar
d_mueck #6
Member since Apr 2006 · 6 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
Thanks for your help.
Avatar
Alex #7
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

we just commited version 0.80 to SVN. This version includes PubSub now.
Its pretty new and still beta. All comments, proposals and changes are welcome.
Check it out and test it.

Alex
Avatar
vmanos2 #8
Member since Feb 2006 · 2 posts · Location: Greece
Group memberships: Members
Show profile · Link to this post
Can you post a code snippet that shows how to subscribe to a node.


Thanks,

Manolis
Avatar
Alex #9
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

checkout the latest code from SVN, there is full PubSub support and a PubSubManager class which lets you subscribe to a node with a single line of code.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS