How to use the @xmpp/component-core.Component function in @xmpp/component-core

To help you get started, we’ve selected a few @xmpp/component-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xmppjs / xmpp.js / packages / component / index.js View on Github external
function component(options) {
  const {password, service, domain} = options

  const entity = new Component({service, domain})

  const reconnect = _reconnect({entity})
  const middleware = _middleware({entity})
  const iqCaller = _iqCaller({entity, middleware})
  const iqCallee = _iqCallee({entity, middleware})

  entity.on('open', async el => {
    try {
      const {id} = el.attrs
      if (typeof password === 'function') {
        await password(creds => entity.authenticate(id, creds))
      } else {
        await entity.authenticate(id, password)
      }
    } catch (err) {
      entity.emit('error', err)

@xmpp/component-core

XMPP component core for JavaScript

ISC
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular @xmpp/component-core functions