Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
wmorrison #1
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Subject: Possible Solution in Matrix
Hello,
      This is more of a question than an issue.  I need to be able to send a user request to my ejabberd server to query a database but I am not sure what feature in Matrix I can use to achieve this.  I was thinking of IQ filter but I am not sure.  Any help would be greatly appreciated.

Regards,
Will
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
can you please elaborate on what you are exactly trying to do?
Do you want to send a query to a user which results in a DB lookup at the user?

IQs are exatly for that. They are Request => Response.

You send a <iq type="get"/> Request and then get a result of <iq type="result"/> or <iq type="error"/> on failure.

See also:
http://www.ag-software.net/matrix-xmpp-sdk/matrix-develope…

Alex
Avatar
wmorrison #3
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,
     Thanks for responding.  I would like a user (via my matrix client) to send a request to a server to retrieve some records.  I have been through the example on the website and totally understand it.  I think IQs should be used but I am not so sure.

Regards,
Will
Avatar
wmorrison #4
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I started playing with your Weather example with the view to understanding how IQ works.  I am able to build and execute the project.  I am able to login into by ejabberd server with out issue.  However when I try to request information I am getting this output for the Debug XML

  1. SEND: <iq id="MX_4" type="get" to="sarah@adminpc/MatriX" xmlns="jabber:client">
  2.  <weather xmlns="ag-software:weather">
  3.     <zip>12345</zip>
  4.  </weather>
  5. </iq>
  6. RECV: <iq from="sarah@adminpc/MatriX" to="karen@adminpc/MatriX" type="error" id="MX_4" xmlns="jabber:client">
  7.  <weather xmlns="ag-software:weather">
  8.     <zip>12345</zip>
  9.  </weather>
  10.  <error code="503" type="cancel">
  11.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  12.  </error>
  13. </iq>

I am not so sure what is causing this error.

Regards,
Will
This post was edited 2 times, last on 2016-03-01, 17:58 by Alex.
Avatar
Alex #5
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
usually you get this error when you send to a wrong entity.

Is the user sarah@adminpc only under the resource MatriX while you send the iq?
The resource part is also case sensitive. From the OnPresence event you get the resource.

Alex
Avatar
wmorrison #6
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,
   You were right, I was using the incorrect resource.  I made that change and now the error is different.

  1. <iq from="sarah@adminpc/adminPC" to="karen@adminpc/MatriX" xml:lang="en" type="error" id="MX_4" xmlns="jabber:client">
  2. <weather xmlns="ag-software:weather">
  3. <zip>22212</zip>
  4. </weather>
  5. <error type="cancel">
  6. <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  7. </error>
  8. </iq>

Finding information on ejabberd is not easy.

Regards
Will
This post was edited on 2016-03-02, 11:42 by Alex.
Avatar
Alex #7
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
It looks like you send the query to a client which does not understand this custom protocol.
You have to run 2 instances of your own code, because only your own code is aware of your own custom XMPP extension and can handle it.

Alex
Avatar
wmorrison #8
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,
       You where right.  I ran both instances of the code and the error disappeared.  The recipient receive the request.  Also I did not see anything registered in the ejabberd log.  The server facilitated the transfer between both users so it must have registered an IQ handle.  Here is the big question for you:  How do I achieve this with the server.  I would like to send an IQ get to the server with the server registering the get request.

Thanks
Will.
Avatar
Alex #9
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The server acted only as a router for you. It routed the packet from entity A to entity B.
So you need 2 client and a server. 1 client probably running 24/7 like a bot.
If you want the server reply to the request then you need to extend your server and write a server module. If you want to do this then you have toi consult the documentation of your server and usually use the programming language your server is build in.

There is also the XEP-0114: Jabber Component Protocol. This allows you to write a component which plugs in to your server. But this is not much different than writing a bot client which is online 24/7
Avatar
wmorrison #10
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,
     Thanks for the guidance.  I am using ejabberd and I am pretty good at Erlang.  However finding good ejabberd docs have been difficult.  But I will press on.  Once thing for sure I will be using Matrix.  My evaluation of the project is now complete I will be documenting this for my company for procurement to start.  Thanks again. 

Regards,
Will
This post was edited on 2016-03-04, 03:52 by wmorrison.
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: MatriX RSS