Localhost Service Discovery For a Custom XEP-0114 Component in Prosody or ejabberd

309 Views Asked by At

I have written a silly hello-world XEP-0114 component and got it connected to Prosody and ejabberd. Now I want to use service discovery to announce presence of the service and provide instructions about its usage.

So I seek a way to make it discoverable for anyone with a JID, remote or local, to provide more details about it.

For Prosody I do:

Component "foo.localhost"
  component_secret = "secret"

disco_items = {
  { "foo.localhost", "FOO BAR" };
}

For ejabberd I do:

modules:
  mod_disco:
    extra_domains:
      - "foo.localhost"
      - "localhost"
    server_info:
      -
        modules: all
        name: "abuse-addresses"
        urls:
          - "foo.com"
listen:
  - 
    port: 8888
    module: ejabberd_service
    access: all
    shaper_rule: fast
    ip: "127.0.0.1"
    hosts:
      "foo.localhost":
        password: "secret"

Then in Gajim I start service discovery on localhost and get error:

There is no service at the address you entered, or it is not responding. Check the address and try again.

What do I miss?

1

There are 1 best solutions below

0
On

First thing to check when in trouble is a XML-console of a xmpp-client (Gajim), there I found this:

<iq xmlns="jabber:client" to="localhost" type="get" id="546">
<query xmlns="http://jabber.org/protocol/disco#info" />
</iq>

<iq xml:lang='en' to='[email protected]/Gajim' from='localhost' type='error' id='546'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
<error code='504' type='wait'>
<remote-server-timeout xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Stream closed by peer: host-unknown</text>
</error>
</iq>

It shows that discovery requests are sent to the server where currently used account is located (jabb.im). I don't know how things work, but this should prompt you to disconnect from remote server, create account on local server and login with it instead, then discovery will work as expected.