How to use the @xmpp/events.timeout function in @xmpp/events

To help you get started, we’ve selected a few @xmpp/events 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
async request(stanza, timeout = 30 * 1000) {
    if (!stanza.attrs.id) {
      stanza.attrs.id = xid()
    }

    const deferred = new Deferred()
    this.handlers.set(stanza.attrs.id, deferred)

    try {
      await this.entity.send(stanza)
      await timeoutPromise(deferred.promise, timeout)
    } catch (err) {
      this.handlers.delete(stanza.attrs.id)
      throw err
    }

    return deferred.promise
  }

@xmpp/events

XMPP events utilities.

ISC
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis