code: function asyncIterator() {
    return {
      next: async () => {
        if (this.closed) {
          return {done: true}
        }
  
        try {
          return {value: await this.receive(), done: false}
        } catch (err) {
          if (this.closed && err.code == "EAGAIN") {
            return {done: true}
          } else {
            throw err
          }
        }
      },
    }
  }
docs: /* Support async iteration over received messages. Implementing this in JS
  is faster as long as there is no C++ native API to chain promises.