How to use the libp2p-mplex.dialer function in libp2p-mplex

To help you get started, we’ve selected a few libp2p-mplex 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 libp2p / go-libp2p-webrtc-direct / examples / standalone / index.js View on Github external
direct.dial(maddr, { config: {} }, (err, conn) => {
    if (err) {
      console.log(`[dialer] Failed to open connection: ${err}`)
    }
    console.log('[dialer] Opened connection')

    const muxer = mplex.dialer(conn)
    const stream = muxer.newStream((err) => {
      console.log('[dialer] Opened stream')
      if (err) throw err
    })

    pull(
      pull.values(['hey, how is it going. I am the dialer']),
      stream
    )
  })
}

libp2p-mplex

JavaScript implementation of https://github.com/libp2p/mplex

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis