Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
s_lincke #1
Member since May 2017 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: DiscoManager.DiscoverItems silently dies
Hey guys,

I am trying to get a List of public chatrooms. My server runs locally as Prosody. I can create users and rooms and login, but I can not get the list of rooms. Here is what I tried:

-- get it async via the domain: this just silently dies and I can not hit breakpoints afterwards oO
  1. var info = await discoManager.DiscoverItemsAsync(m_config.ChatDomain); // ChatDomain is here "localhost"

-- get it async via Host: same behaviour
  1. var info = await discoManager.DiscoverItemsAsync(m_config.ChatConfHost); // ChatConfHost is here "conference.localhost"

-- get it via EventHandler callback
  1.  
  2.         private void DiscoItemsResult(object sender, IqEventArgs e)
  3.         {
  4.             // we will never get here
  5.             var foo = "asdfsadf";
  6.         }
  7.  
  8. [...]
  9.  
  10. discoManager.DiscoverItems(m_config.ChatDomain, new EventHandler<IqEventArgs>(DiscoItemsResult));

-- get via discoManager eventHandlers - none of the breakpoints inside the event handlers get ever hit

  1. discoManager.OnDiscoItemsResult += (object sender, DiscoIqEventArgs eventArgs) =>
  2.                     {
  3.                         var foo = "bar";
  4.                     };
  5.  
  6.                     discoManager.OnDiscoItemsError += (object sender, DiscoIqEventArgs eventArgs) =>
  7.                     {
  8.                         var foo = "bar";
  9.                     };
  10.  
  11.                     discoManager.OnDiscoItemsRequest += (object sender, DiscoIqEventArgs eventArgs) =>
  12.                     {
  13.                         var foo = "bar";
  14.                     };
  15.  
  16.                     discoManager.OnDiscoInfoError += (object sender, DiscoIqEventArgs eventArgs) =>
  17.                     {
  18.                         var foo = "bar";
  19.                     };
  20.  
  21.                     discoManager.OnDiscoInfoRequest += (object sender, DiscoIqEventArgs eventArgs) =>
  22.                     {
  23.                         var foo = "bar";
  24.                     };
  25.  
  26.                     discoManager.OnDiscoInfoResult += (object sender, DiscoIqEventArgs eventArgs) =>
  27.                     {
  28.                         var foo = "bar";
  29.                     };
  30.  
  31.                     discoManager.DiscoverItems(m_config.ChatDomain);

Also I tried all of the above with DiscoverItems("localhost", (full) user-Jid), DiscoverItems("conference.localhost", (full) user-Jid), and various combinations and jid variations. I am completely lost, why does it not give me anything but dies silently? All I get is "The thread 0x1218 has exited with code 0 (0x0).". Is there any documentation I am missing?

Thanks!
This post was edited on 2017-05-30, 18:34 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
DiscoverItems against the Jid conference.localhost should be fine for Prosody.

I added a simple command Button to the MiniClient example and it works fine for me.

  1. private async void buttonTest_Click_1(object sender, System.EventArgs e)
  2. {
  3.     var dm = new DiscoManager(this.xmppClient);
  4.     var res = await dm.DiscoverItemsAsync("conference.ag-software.net");
  5. }
Avatar
s_lincke #3
Member since May 2017 · 3 posts
Group memberships: Members
Show profile · Link to this post
Thank you! I made some progress - the xmppClient was not Open()ed before -.-. (An exception or message of any kind would have been really helpful!)

However, now I am getting an answer, with both the async and the callback method, but it says:
  1. <error type="cancel" xmlns="jabber:client">
  2.  <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  3. </error>


edit: these modules are enabled in prosody:
modules_enabled = {

    -- Generally required
        "roster"; -- Allow users to have a roster. Recommended ;)
        "saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
        "tls"; -- Add support for secure TLS on c2s/s2s connections
        "dialback"; -- s2s dialback support
        "disco"; -- Service discovery

    -- Not essential, but recommended
        "private"; -- Private XML storage (for room bookmarks, etc.)
        "vcard"; -- Allow users to set vCards
   
    -- These are commented by default as they have a performance impact
        --"privacy"; -- Support privacy lists
        --"compression"; -- Stream compression

    -- Nice to have
        "version"; -- Replies to server version requests
        "uptime"; -- Report how long server has been running
        "time"; -- Let others know the time here on this server
        "ping"; -- Replies to XMPP pings with pongs
        "pep"; -- Enables users to publish their mood, activity, playing music and more
        "register"; -- Allow users to register on this server using a client and change passwords

    -- Admin interfaces
        "admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
        --"admin_telnet"; -- Opens telnet console interface on localhost port 5582
   
    -- HTTP modules
        --"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
        --"http_files"; -- Serve static files from a directory over HTTP

    -- Other specific functionality
        --"groups"; -- Shared roster support
        --"announce"; -- Send announcement to all online users
        --"welcome"; -- Welcome users who register accounts
        --"watchregistrations"; -- Alert admins of registrations
        --"motd"; -- Send a message to users when they log in
        --"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
};
This post was edited 2 times, last on 2017-05-30, 19:53 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please post the complete Xml log of your session.
You also must be logged in to your server, and the session must be ready before you can send the disco info request.

Also see here on how to configure MUC in Prosody:
http://prosody.im/doc/modules/mod_muc
This post was edited on 2017-05-30, 19:55 by Alex.
Avatar
s_lincke #5
Member since May 2017 · 3 posts
Group memberships: Members
Show profile · Link to this post
the session must be ready before you can send the disco info request.

Solved it, thank you! Still wondering, why it just disappeared on me instead of giving me a hint.
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Don't send the disco request before you got the OnBind event
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: