Handing DISCO#info requests
The one last bit that we want to complete is the handleIq()
function that we alluded to in the handleMessage()
function. This function will respond with a message giving the capabilities offered by this server-side component specifically, its ability to play XMPPong, which is indicated in part by the identity of the reply as well as the feature that contains the XMPPong namespace:
const handleIq = (stanza) => { const query = stanza.getChild('query', 'http://jabber.org/protocol/disco#info') if (!query) return const reply = new Stanza( 'iq', { type: 'result', id: stanza.attrs.id, from: stanza.attrs.to, to: stanza.attrs.from } ) .c('query', { xmlns: 'http://jabber.org/protocol/disco#info' }) reply.c('identity',{category: 'chat', name: 'XMPPong', type:'text'}) reply.c('feature', { var: PONG_NAMESPACE }) ...