Not logged in. · Lost password · Register
Forum: MatriX RSS
Page:  1  2  next
Avatar
peternorman #1
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
Subject: Basic Publish-Subscribe Example
Hello,

I'm very new to XMPP and I wish to create a simple Publish-Subscribe example. I'm having trouble publishing an Item as I receive the following:

  1. <iq type="error" id="MX_3" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  2.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  3.     <publish node="cjis-topic">
  4.       <item>foo</item>
  5.     </publish>
  6.  </pubsub>
  7.  <error code="403" type="auth">
  8.     <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  9.  </error>
  10. </iq>
I'm using a local OpenFire server.

I created the node to subscribe to via the mini client example provided by AG Software.
Below is the relevant sections of the code I'm using:

  1. namespace AnotherChat
  2. {
  3.     public partial class MainWindow : Window
  4.     {
  5.         private Matrix.Xmpp.Client.XmppClient xmppClient;
  6.         private Login login;
  7.         private PubSubManager pubSubManager;
  8.  
  9.         public MainWindow()
  10.         {
  11.             InitializeComponent();
  12.             Connect();
  13.         }
  14.  
  15.         private void Connect()
  16.         {
  17.             xmppClient = new XmppClient();
  18.             login = new Login();
  19.             string user = "pnorman2";
  20.             string pass = "pnorman2";
  21.             string domain = "pnorman-pc";
  22.  
  23.             xmppClient = new XmppClient();
  24.             xmppClient.SetUsername(user);
  25.             xmppClient.SetXmppDomain(domain);
  26.             xmppClient.Password = pass;
  27.  
  28.             xmppClient.Status = "ready for chat";
  29.             xmppClient.Show = Matrix.Xmpp.Show.chat;
  30.  
  31.             xmppClient.OnIq += new EventHandler<IqEventArgs>(xmppClient_OnIq);
  32.             xmppClient.OnMessage += new EventHandler<MessageEventArgs>(xmppClient_OnMessage);
  33.             xmppClient.OnLogin += new EventHandler<Matrix.EventArgs>(xmppClient_OnLogin);
  34.             xmppClient.OnReceiveXml += new EventHandler<Matrix.TextEventArgs>(xmppClient_OnReceiveXml);
  35.             xmppClient.OnError += new EventHandler<Matrix.ExceptionEventArgs>(xmppClient_OnError);
  36.             xmppClient.OnRosterEnd += new EventHandler<Matrix.EventArgs>(xmppClient_OnRosterEnd);
  37.             xmppClient.OnSendXml += new EventHandler<TextEventArgs>(xmppClient_OnSendXml);
  38.  
  39.             login.User = user;
  40.             login.Server = domain;
  41.             login.Password = pass;
  42.  
  43.             xmppClient.StartTls = false;
  44.             xmppClient.Open();
  45.         }
  46.  
  47.         void xmppClient_OnLogin(object sender, Matrix.EventArgs e)
  48.         {
  49.             Console.WriteLine(e.State);
  50.             pubSubManager = new PubSubManager(xmppClient);
  51.  
  52.             Jid pubsubJid = new Jid("pubsub.pnorman-pc");
  53.             string node = "cjis-topic";
  54.  
  55.             var myBareJid = new Jid { User = xmppClient.Username, Server = xmppClient.XmppDomain };
  56.             pubSubManager.Subscribe(pubsubJid, node, myBareJid, OnSubscribeResult, node);
  57.             pubSubManager.OnEvent += new EventHandler<MessageEventArgs>(pubSubManager_OnEvent);
  58.             Item x = new Item { Value = "foo" };
  59.             pubSubManager.PublishItem(pubsubJid, node, x);
  60.         }
  61.     }
  62. }

Don't know if this will help but here is the output that I receive from the application:

  1. *** Send ***
  2. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="pnorman-pc" version="1.0" >
  3. *** Receive ***
  4. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="pnorman-pc" id="20e4fa1" xml:lang="en" version="1.0" >
  5. *** Receive ***
  6. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  7.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  8.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  9.     <mechanism>DIGEST-MD5</mechanism>
  10.     <mechanism>PLAIN</mechanism>
  11.     <mechanism>ANONYMOUS</mechanism>
  12.     <mechanism>CRAM-MD5</mechanism>
  13.  </mechanisms>
  14.  <compression xmlns="http://jabber.org/features/compress">
  15.     <method>zlib</method>
  16.  </compression>
  17.  <auth xmlns="http://jabber.org/features/iq-auth" />
  18.  <register xmlns="http://jabber.org/features/iq-register" />
  19. </stream:features>
  20. *** Send ***
  21. <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  22. *** Receive ***
  23. <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09InBub3JtYW4tcGMiLG5vbmNlPSJUb3F4a1NKUzJNS2JRdFZRYkQ4OE0zS1lwTVRqNnN4Lzc3b29yT0dvIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
  24. *** Send ***
  25. <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9InBub3JtYW4yIixyZWFsbT0icG5vcm1hbi1wYyIsbm9uY2U9IlRvcXhrU0pTMk1LYlF0VlFiRDg4TTNLWXBNVGo2c3gvNzdvb3JPR28iLGNub25jZT0iNmQ5YWQxMjMzMDVkNWI5MjNhOWExNDRhODkxYTcwMTc5MTFmOWY3YTVlY2Y0NmNjYWM1NmE4M2U5ODFhMWI3NCIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9wbm9ybWFuLXBjIixjaGFyc2V0PXV0Zi04LHJlc3BvbnNlPTY2YmIyMmE2NmU5YTczZjNlMjUxYzhmY2FjZTUzOGM1</response>
  26. *** Receive ***
  27. <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD05NmQ0MjkwOGFmNjAwYjBkYTRlZmY5ZTc1NjE0MzIzZg==</success>
  28.  
  29. *** Send ***
  30. <iq id="MX_2" to="pubsub.pnorman-pc" type="set" xmlns="jabber:client">
  31.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  32.     <subscribe node="cjis-topic" jid="pnorman2@pnorman-pc" />
  33.  </pubsub>
  34. </iq>
  35. *** Send ***
  36. <iq id="MX_3" to="pubsub.pnorman-pc" type="set" xmlns="jabber:client">
  37.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  38.     <publish node="cjis-topic">
  39.       <item>foo</item>
  40.     </publish>
  41.  </pubsub>
  42. </iq>
  43. *** Send ***
  44. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="pnorman-pc" version="1.0" >
  45. *** Receive ***
  46. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="pnorman-pc" id="20e4fa1" lang="en" version="1.0" >
  47. *** Receive ***
  48. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  49.  <compression xmlns="http://jabber.org/features/compress">
  50.     <method>zlib</method>
  51.  </compression>
  52.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  53.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  54. </stream:features>
  55. *** Send ***
  56. <iq id="MX_1" type="set" xmlns="jabber:client">
  57.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  58.     <resource>MatriX</resource>
  59.  </bind>
  60. </iq>
  61. *** Receive ***
  62. <iq type="result" id="MX_1" to="pnorman-pc/20e4fa1" xmlns="jabber:client">
  63.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  64.     <jid>pnorman2@pnorman-pc/MatriX</jid>
  65.  </bind>
  66. </iq>
  67. *** Send ***
  68. <iq id="MX_4" type="set" xmlns="jabber:client">
  69.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  70. </iq>
  71. <iq type="result" id="MX_1" to="pnorman-pc/20e4fa1" xmlns="jabber:client">
  72.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  73.     <jid>pnorman2@pnorman-pc/MatriX</jid>
  74.  </bind>
  75. </iq>
  76. *** Receive ***
  77. <iq type="result" id="MX_2" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  78.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  79.     <subscription node="cjis-topic" jid="pnorman2@pnorman-pc" subid="w4Vj4144RFyq5FvAfrgrupD5Bn1WO2IhJ5vGklda" subscription="subscribed">
  80.       <subscribe-options />
  81.     </subscription>
  82.  </pubsub>
  83. </iq>
  84. Success
  85. <iq type="result" id="MX_2" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  86.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  87.     <subscription node="cjis-topic" jid="pnorman2@pnorman-pc" subid="w4Vj4144RFyq5FvAfrgrupD5Bn1WO2IhJ5vGklda" subscription="subscribed">
  88.       <subscribe-options />
  89.     </subscription>
  90.  </pubsub>
  91. </iq>
  92. *** Receive ***
  93. <iq type="error" id="MX_3" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  94.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  95.     <publish node="cjis-topic">
  96.       <item>foo</item>
  97.     </publish>
  98.  </pubsub>
  99.  <error code="403" type="auth">
  100.     <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  101.  </error>
  102. </iq>
  103. <iq type="error" id="MX_3" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  104.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  105.     <publish node="cjis-topic">
  106.       <item>foo</item>
  107.     </publish>
  108.  </pubsub>
  109.  <error code="403" type="auth">
  110.     <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  111.  </error>
  112. </iq>
  113. *** Receive ***
  114. <iq type="result" id="MX_4" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client" />
  115. *** Send ***
  116. <iq id="MX_5" type="get" xmlns="jabber:client">
  117.  <query xmlns="jabber:iq:roster" />
  118. </iq>
  119. <iq type="result" id="MX_4" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client" />
  120. *** Receive ***
  121. <iq type="result" id="MX_5" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">

Thanks,
Peter Norman
This post was edited 3 times, last on 2013-02-26, 19:36 by Alex.
Edit reason: fixed code formatting
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
We have developed the publish example with an ejabberd server.
We got reports that Openfire does not like the payload which is the text "foo" only in your xml.

Can you try to publish a complete small xml document like:

  1. <foo xmlns="yourns">test</foo>

example:

  1. public class FooPayload : XmppXElement
  2. {
  3.     public FooPayload()
  4.         : base("yourns", "foo")
  5.     {
  6.     }
  7. }
  8.  
  9. var item = new Matrix.Xmpp.PubSub.Item();
  10. item.Add(new FooPayload {Value = "Test"});
  11. pubsubManager.PublishItem("pubsub.pnorman-pc", "cjis-topic", item);

Alex
Avatar
peternorman #3
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex,

I tried your suggestion but I'm seeing the same results:

  1. *** Send ***
  2. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="pnorman-pc" version="1.0" >
  3. *** Receive ***
  4. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="pnorman-pc" id="5ef1c673" xml:lang="en" version="1.0" >
  5. *** Receive ***
  6. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  7.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  8.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  9.     <mechanism>DIGEST-MD5</mechanism>
  10.     <mechanism>PLAIN</mechanism>
  11.     <mechanism>ANONYMOUS</mechanism>
  12.     <mechanism>CRAM-MD5</mechanism>
  13.  </mechanisms>
  14.  <compression xmlns="http://jabber.org/features/compress">
  15.     <method>zlib</method>
  16.  </compression>
  17.  <auth xmlns="http://jabber.org/features/iq-auth" />
  18.  <register xmlns="http://jabber.org/features/iq-register" />
  19. </stream:features>
  20. *** Send ***
  21. <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  22. *** Receive ***
  23. <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09InBub3JtYW4tcGMiLG5vbmNlPSJlaXhpZmovdEI0MSsyaTlkSHVEbkF6Ry9LSGpNNGVSSUc3MXN5YzdKIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
  24. *** Send ***
  25. <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9InBub3JtYW4yIixyZWFsbT0icG5vcm1hbi1wYyIsbm9uY2U9ImVpeGlmai90QjQxKzJpOWRIdURuQXpHL0tIak00ZVJJRzcxc3ljN0oiLGNub25jZT0iMzQ2NzY1M2UxZDQzZDUwNDAyZjcwMzYzZTI2ZmYxZjI5Mjg0YTczNmMxMjg5ZDYyNWNlMjI0NDIxOWQyYTVjNSIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9wbm9ybWFuLXBjIixjaGFyc2V0PXV0Zi04LHJlc3BvbnNlPTY3Y2FjNWY2YjkyZjBkNzUyYTc4ZTJiZTA0ZGJkZGRh</response>
  26. *** Receive ***
  27. <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD0xZjEyNDVkZDBiNmNmMjkxYWE1MGU0YTI1ZTIxMWFmOA==</success>
  28.  
  29. *** Send ***
  30. <iq id="MX_2" to="pubsub.pnorman-pc" type="set" xmlns="jabber:client">
  31.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  32.     <subscribe node="cjis-topic" jid="pnorman2@pnorman-pc" />
  33.  </pubsub>
  34. </iq>
  35. *** Send ***
  36. <iq id="MX_3" to="pubsub.pnorman-pc" type="set" xmlns="jabber:client">
  37.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  38.     <publish node="cjis-topic">
  39.       <item>
  40.         <foo xmlns="anotherchat:mobile">Test</foo>
  41.       </item>
  42.     </publish>
  43.  </pubsub>
  44. </iq>
  45. *** Send ***
  46. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="pnorman-pc" version="1.0" >
  47. *** Receive ***
  48. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="pnorman-pc" id="5ef1c673" lang="en" version="1.0" >
  49. *** Receive ***
  50. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  51.  <compression xmlns="http://jabber.org/features/compress">
  52.     <method>zlib</method>
  53.  </compression>
  54.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  55.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  56. </stream:features>
  57. *** Send ***
  58. <iq id="MX_1" type="set" xmlns="jabber:client">
  59.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  60.     <resource>MatriX</resource>
  61.  </bind>
  62. </iq>
  63. *** Receive ***
  64. <iq type="result" id="MX_1" to="pnorman-pc/5ef1c673" xmlns="jabber:client">
  65.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  66.     <jid>pnorman2@pnorman-pc/MatriX</jid>
  67.  </bind>
  68. </iq>
  69. *** Send ***
  70. <iq id="MX_4" type="set" xmlns="jabber:client">
  71.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  72. </iq>
  73. <iq type="result" id="MX_1" to="pnorman-pc/5ef1c673" xmlns="jabber:client">
  74.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  75.     <jid>pnorman2@pnorman-pc/MatriX</jid>
  76.  </bind>
  77. </iq>
  78. *** Receive ***
  79. <iq type="result" id="MX_2" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  80.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  81.     <subscription node="cjis-topic" jid="pnorman2@pnorman-pc" subid="ALkPeCnu7u2d8Yvhq0tbnTkzriMhv722ln3wzs6C" subscription="subscribed">
  82.       <subscribe-options />
  83.     </subscription>
  84.  </pubsub>
  85. </iq>
  86. Success
  87. <iq type="result" id="MX_2" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  88.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  89.     <subscription node="cjis-topic" jid="pnorman2@pnorman-pc" subid="ALkPeCnu7u2d8Yvhq0tbnTkzriMhv722ln3wzs6C" subscription="subscribed">
  90.       <subscribe-options />
  91.     </subscription>
  92.  </pubsub>
  93. </iq>
  94. *** Receive ***
  95. <iq type="error" id="MX_3" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  96.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  97.     <publish node="cjis-topic">
  98.       <item>
  99.         <foo xmlns="anotherchat:mobile">Test</foo>
  100.       </item>
  101.     </publish>
  102.  </pubsub>
  103.  <error code="403" type="auth">
  104.     <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  105.  </error>
  106. </iq>
  107. <iq type="error" id="MX_3" from="pubsub.pnorman-pc" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  108.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  109.     <publish node="cjis-topic">
  110.       <item>
  111.         <foo xmlns="anotherchat:mobile">Test</foo>
  112.       </item>
  113.     </publish>
  114.  </pubsub>
  115.  <error code="403" type="auth">
  116.     <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  117.  </error>
  118. </iq>
  119. *** Receive ***
  120. <iq type="result" id="MX_4" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client" />
  121. *** Send ***
  122. <iq id="MX_5" type="get" xmlns="jabber:client">
  123.  <query xmlns="jabber:iq:roster" />
  124. </iq>
  125. <iq type="result" id="MX_4" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client" />
  126. *** Receive ***
  127. <iq type="result" id="MX_5" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  128.  <query xmlns="jabber:iq:roster">
  129.     <item jid="pnorman" subscription="none" />
  130.     <item jid="cjis" name="null" subscription="to" />
  131.  </query>
  132. </iq>
  133.  
  134. *** Send ***
  135. <presence xmlns="jabber:client">
  136.  <show>chat</show>
  137.  <status>ready for chat</status>
  138.  <priority>0</priority>
  139. </presence>
  140. <iq type="result" id="MX_5" to="pnorman2@pnorman-pc/MatriX" xmlns="jabber:client">
  141.  <query xmlns="jabber:iq:roster">
  142.     <item jid="pnorman" subscription="none" />
  143.     <item jid="cjis" name="null" subscription="to" />
  144.  </query>
  145. </iq>
  146. *** Receive ***
  147. <presence to="pnorman2@pnorman-pc/MatriX" from="cjis" type="error" xmlns="jabber:client">
  148.  <error code="404" type="cancel">
  149.     <remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  150.  </error>
  151. </presence>
This post was edited on 2013-02-26, 20:40 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you publish to early. Even before your XMPP session is ready. Please wait until your get the OnRosterEnd event or the first OnPresence event. I see also some packets twice in your log.

If it still does not work post or attach your log again.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
And you also have to wait for the reply when you create your node. You cannot create the node and publish to it in a row.
The node must be created first on the server before you can publish.

When you create the node pass a callback function and check the result. When not error then you can publish.

Alex
Avatar
peternorman #6
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
Thanks, I will give it a shot.
Avatar
peternorman #7
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
Alex,

Thinking that I was probably doing multiple things wrong in my code I decided to try to publish directly via the mini client example that is provided. I installed a local ejabberd server just to be on the safe side, since at this point I don't have a preference.

That being said here is the result:

  1. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_8" type="result" xmlns="jabber:client">
  2.  <query xmlns="http://jabber.org/protocol/disco#info" node="announce" />
  3. </iq>
  4. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_9" type="result" xmlns="jabber:client">
  5.  <query xmlns="http://jabber.org/protocol/disco#info" node="config" />
  6. </iq>
  7. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_10" type="result" xmlns="jabber:client">
  8.  <query xmlns="http://jabber.org/protocol/disco#info" node="user" />
  9. </iq>
  10. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_11" type="result" xmlns="jabber:client">
  11.  <query xmlns="http://jabber.org/protocol/disco#info" node="online users" />
  12. </iq>
  13. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_12" type="result" xmlns="jabber:client">
  14.  <query xmlns="http://jabber.org/protocol/disco#info" node="all users" />
  15. </iq>
  16. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_13" type="result" xmlns="jabber:client">
  17.  <query xmlns="http://jabber.org/protocol/disco#info" node="outgoing s2s" />
  18. </iq>
  19. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_14" type="result" xmlns="jabber:client">
  20.  <query xmlns="http://jabber.org/protocol/disco#info" node="running nodes" />
  21. </iq>
  22. RECV: <iq from="pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_15" type="result" xmlns="jabber:client">
  23.  <query xmlns="http://jabber.org/protocol/disco#info" node="stopped nodes" />
  24. </iq>
  25. RECV: <iq from="pubsub.pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_16" type="result" xmlns="jabber:client">
  26.  <query xmlns="http://jabber.org/protocol/disco#items">
  27.     <item jid="pubsub.pnorman-pc" node="/home" />
  28.     <item jid="pubsub.pnorman-pc" node="TestNode" />
  29.  </query>
  30. </iq>
  31. SEND: <iq id="MX_17" type="get" to="pubsub.pnorman-pc" xmlns="jabber:client">
  32.  <query node="/home" xmlns="http://jabber.org/protocol/disco#items" />
  33. </iq>
  34. SEND: <iq id="MX_18" type="get" to="pubsub.pnorman-pc" xmlns="jabber:client">
  35.  <query node="TestNode" xmlns="http://jabber.org/protocol/disco#items" />
  36. </iq>
  37. RECV: <iq from="pubsub.pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_17" type="result" xmlns="jabber:client">
  38.  <query xmlns="http://jabber.org/protocol/disco#items" node="/home">
  39.     <item jid="pubsub.pnorman-pc" node="/home/pnorman-pc" />
  40.  </query>
  41. </iq>
  42. SEND: <iq id="MX_19" type="get" to="pubsub.pnorman-pc" xmlns="jabber:client">
  43.  <query node="/home/pnorman-pc" xmlns="http://jabber.org/protocol/disco#items" />
  44. </iq>
  45. RECV: <iq from="pubsub.pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_18" type="result" xmlns="jabber:client">
  46.  <query xmlns="http://jabber.org/protocol/disco#items" node="TestNode" />
  47. </iq>
  48. RECV: <iq from="pubsub.pnorman-pc" to="admin@pnorman-pc/MatriX" id="MX_19" type="result" xmlns="jabber:client">
  49.  <query xmlns="http://jabber.org/protocol/disco#items" node="/home/pnorman-pc" />
  50. </iq>
  51. SEND: <iq id="MX_20" to="pubsub.pnorman-pc" type="set" xmlns="jabber:client">
  52.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  53.     <publish node="TestNode">
  54.       <item>Test Payload</item>
  55.     </publish>
  56.  </pubsub>
  57. </iq>
  58. RECV: <iq from="pubsub.pnorman-pc" to="admin@pnorman-pc/MatriX" type="error" id="MX_20" xmlns="jabber:client">
  59.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  60.     <publish node="TestNode">
  61.       <item>Test Payload</item>
  62.     </publish>
  63.  </pubsub>
  64.  <error code="400" type="modify">
  65.     <bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  66.     <invalid-payload xmlns="http://jabber.org/protocol/pubsub#errors" />
  67.  </error>
  68. </iq>

I created a node named TestNode via the miniclient. I then attempted to publish the message "Test Payload" to the TestNode.

Thanks
This post was edited on 2013-02-26, 21:49 by Alex.
Avatar
Alex #8
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
ejabberd has a pubsub node structure like a treeview.

This is described here:
http://www.ejabberd.im/mod_pubsub-usage

can you try to create your nodes like described on this page?

Alex
Avatar
peternorman #9
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
Thanks, I will give it a try.
Avatar
Alex #10
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I just verified it on our ejabberd server and it works fine.

I login with the user alice@ag-software.de

then I first create the node /home/ag-software.de/alice for this user because it did not exist.
Select the pubsub service in the combo, enter the nodename in the textbox and click create node.

  1. SEND: <iq id="MX_13" type="set" to="pubsub.ag-software.de" xmlns="jabber:client">
  2.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  3.     <create node="/home/ag-software.de/alice" />
  4.     <configure />
  5.  </pubsub>
  6. </iq>
  7. RECV: <iq from="pubsub.ag-software.de" to="alice@ag-software.de/MatriX" id="MX_13" type="result" xmlns="jabber:client">
  8.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  9.     <create node="/home/ag-software.de/alice" />
  10.  </pubsub>
  11. </iq>


now I publish with the code I posted before to the new node. here is the xml log:

  1. SEND: <iq id="MX_14" to="pubsub.ag-software.de" type="set" xmlns="jabber:client">
  2.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  3.     <publish node="/home/ag-software.de/alice">
  4.       <item>
  5.         <foo xmlns="yourns">Test</foo>
  6.       </item>
  7.     </publish>
  8.  </pubsub>
  9. </iq>
  10. RECV: <iq from="pubsub.ag-software.de" to="alice@ag-software.de/MatriX" id="MX_14" type="result" xmlns="jabber:client">
  11.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  12.     <publish node="/home/ag-software.de/alice">
  13.       <item id="551DF556877F8" />
  14.     </publish>
  15.  </pubsub>
  16. </iq>
Avatar
peternorman #11
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
That worked perfectly thanks for all your help!
Avatar
Alex #12
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
great, when I have some time I'll do a research about the node semantics on Openfire and post an update.
Avatar
robomotic #13
Member since Jun 2014 · 8 posts
Group memberships: Members
Show profile · Link to this post
Hello Alex,Peter,
I am just starting to develop with Matrix and would like to have a look at the fully working code from Peter.
Is it possible to put it as an example in the documentation since I think pubsub is a common functionality .

Cheers.
Avatar
Alex #14
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I don't have Peters code.

When you download the full Desktop version of MatiX then there are many examples inlcuded. In the MiniClient example there is also  a PubSub example included. There is a Windows Form called FrmPubSub.
When you still have questions just post them here.

Alex
Avatar
robomotic #15
Member since Jun 2014 · 8 posts
Group memberships: Members
Show profile · Link to this post
Hello alex,
I just noticed I have the same issue with the following configuration:
hostname is minint-r8cp662
combobox on the pubsub shows pubsub.minint-r8cp662
username is epokh

When I attempt to create a node with the same syntax structure:

  1. SEND: <iq id="MX_44" to="pubsub.minint-r8cp662" type="set" xmlns="jabber:client">
  2.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  3.     <publish node="/home/pubsub.minint-r8cp662/epokh">
  4.       <item>TEST</item>
  5.     </publish>
  6.  </pubsub>
  7. </iq>
  8. RECV: <iq type="error" id="MX_44" from="pubsub.minint-r8cp662" to="epokh@minint-r8cp662/Laptop1" xmlns="jabber:client">
  9.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  10.     <publish node="/home/pubsub.minint-r8cp662/epokh">
  11.       <item>TEST</item>
  12.     </publish>
  13.  </pubsub>
  14.  <error code="400" type="modify">
  15.     <bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  16.     <payload-required xmlns="http://jabber.org/protocol/pubsub#errors" />
  17.  </error>
  18. </iq>

What am I doing wrong?

Edit: oky big mistake here I am using OpenFire but that structure was only for Ejabberd.
Is there an equivalente format that OpenFire uses for creating nodes?
This post was edited 2 times, last on 2014-06-19, 10:40 by 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:
Page:  1  2  next
Forum: MatriX RSS