Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@xmpp/resolve

0.11.0 • Public • Published

resolve

XMPP connection methods resolution for JavaScript

@xmpp/resolve retrieves and sorts possible XMPP endpoints using DNS and HTTP Web Host Metadata.

Install

npm install @xmpp/resolve

Usage

const resolve = require('@xmpp/resolve')
 
// optional
const options = {
  srv: [{service: 'xmpp-client', protocol: 'tcp'}], // SRV records
  family: undefined, // IP version; 4, 6 or undefined for both
  owner: '_xmppconnect', // TXT owner
}
 
resolve('xmppjs.org', options)
  .then(console.log)
  .catch(console.error)
;[
  {
    address: '93.113.206.189',
    family: 4,
    name: 'xmppjs.org',
    port: 5222,
    priority: 5,
    weight: 0,
  },
  {
    address: '2a03:75c0:39:3458::1',
    family: 6,
    name: 'xmppjs.org',
    port: 5222,
    priority: 5,
    weight: 0,
  },
  {address: '93.113.206.189', family: 4},
  {address: '2a03:75c0:39:3458::1', family: 6},
  {
    attribute: '_xmpp-client-websocket',
    uri: 'wss://xmppjs.org:443/websocket',
  },
  {
    attribute: '_xmpp-client-xbosh',
    uri: 'https://xmppjs.org:443/bosh',
  },
]

References

Install

npm i @xmpp/resolve

DownloadsWeekly Downloads

4,453

Version

0.11.0

License

ISC

Unpacked Size

15 kB

Total Files

12

Last publish

Collaborators

  • avatar