How to use @xmpp/middleware - 1 common examples

To help you get started, we’ve selected a few @xmpp/middleware 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 / iq / caller.js View on Github external
_route({type, name, id, stanza}, next) {
    if (!isReply({name, type})) return next()

    const deferred = this.handlers.get(id)

    if (!deferred) {
      return next()
    }

    if (type === 'error') {
      deferred.reject(StanzaError.fromElement(stanza.getChild('error')))
    } else {
      deferred.resolve(stanza)
    }

    this.handlers.delete(id)
  }

@xmpp/middleware

XMPP middleware for JavaScript

ISC
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular @xmpp/middleware functions