Allow service discovery over XMPP
We must support XMPP Service Discovery to make our VTN's services known.
From the docs:
After a VEN has completed session initiation, it may perform an XEP0030 ‘info’ query to the bare domain to which the VEN has authenticated. For example, if a VEN has connected as ‘[email protected]/client’ then its initial service discovery query would look like the following:
<iq type='get'
from='[email protected]/client'
to='xmpp.somevtn.net'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
To which the server would respond:
<iq type='result'
from='xmpp.somevtn.net'
to='[email protected]/client'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<feature var='http://openadr.org/openadr2'/>
<feature var='http://jabber.org/protocol/disco'/>
</query>
</iq>
This indicates, in an XMPP-compliant fashion that the XMPP server supports the OpenADR2 protocol.
Then VEN may then perform an ‘items’ query, with the ‘node’ set to the OpenADR2 namespace 'http://openadr.org/openadr2#services' as such:
<iq type='get'
from='[email protected]/client'
to='xmpp.somevtn.net'
id='items1'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='http://openadr.org/openadr2#services'/>
</iq>
The VTN must then respond with the JIDs used for each OpenADR2 service, for example:
<iq type='result'
from='xmpp.somevtn.net'
to='[email protected]/client'
id='items1'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='http://openadr.org/OpenADR2#services'>
<item jid='event.openadr2.xmpp.somevtn.net'
node='http://openadr.org/OpenADR2/EiEvent' />
<item jid='feedback.openadr2.xmpp.somevtn.net'
node='http://openadr.org/OpenADR2/EiFeedback' />
</query>
</iq>
Note that all services could use the same JID or different JIDs and JIDs may be subdomains (which are common for XMPP services) or fully-qualified with a ‘localpart’ and resource.