Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
Jeff #1
Member since Jul 2018 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: PEP Notifications
Hello,
I am trying to implement Personal Eventing Protocol, but I'm having an issue where clients do not receive notifications when a user publishes an event. I'm not sure if I'm missing a step.
What I am currently doing is first sending the capabilities of the client in their initial presence by having the DiscoManager auto send it and show interest in the location+notify event:
  1. DiscoManager disco = new DiscoManager(xmppClient);
  2. disco.AutoSendCaps = true;
  3. disco.Node = "http://www.test.com";
  4. disco.AddFeature("http://jabber.org/protocol/location+notify");

This automatically sends the capabilities when my presence is sent:
  1. <presence xmlns="jabber:client">
  2.  <show>chat</show>
  3.  <status></status>
  4.  <priority>0</priority>
  5.  <c hash="sha-1" ver="3vRWndC2mEZfFvIM2/ZrIg4oEb4=" node="http://www.test.com" xmlns="http://jabber.org/protocol/caps" />
  6. </presence>

I then publish an item using the PubSubManager:
  1. PubSubManager pubSub = new PubSubManager(xmppClient);
  2. Matrix.Xmpp.PubSub.Item item = new Matrix.Xmpp.PubSub.Item(new Location() {
  3.   LocationName = "MyLocation"
  4. });
  5. pubSub.PublishItem(null, "http://jabber.org/protocol/location", item)

This sends out the follwing:
  1. <iq id="MX_10" type="set" xmlns="jabber:client">
  2.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  3.     <publish node="http://jabber.org/protocol/location">
  4.       <item>
  5.         <location xmlns="location">
  6.           <locationName>MyLocation</locationName>
  7.         </location>
  8.       </item>
  9.     </publish>
  10.  </pubsub>
  11. </iq>

The user receives their own response back, but no other users receive any information after the event is published. Can you tell me if I am doing this correctly?

Thanks,
Jeff
This post was edited on 2018-07-10, 22:14 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Jeff,

Do your clients reply to Disco requests? This is required, otherwise your server cannot decode and cache the caps and understand the caps version (hash).

Alex
Avatar
Jeff #3
Member since Jul 2018 · 2 posts
Group memberships: Members
Show profile · Link to this post
Ah, yes, that seems to be the problem.
I added code to reply to disco requests:
  1. private void OnDiscoInfoRequest(object sender, Matrix.Xmpp.Disco.DiscoIqEventArgs e)
  2. {
  3.    e.Info.AddFeature(new Matrix.Xmpp.Disco.Feature("location+notify"));
  4. }
And other clients now begin to receive notifications.

Thanks!
Jeff
This post was edited on 2018-07-11, 18:24 by Alex.
Edit reason: added code formatting
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
when you use the DisoManager MatriX can handle this also fully automatically for you.

When you set AutoReplyToDiscoInfo to true, then MatriX automatically replies with all the Features and Identities you set in the DiscoManager.

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: