### libp2p-webrtc-star

`0.17.1`
Need help reading this?

## Intro

Installable via `npm install --save libp2p-webrtc-star`, it can also be used directly in the browser.

## Download

The source is available for download from GitHub. Alternatively, you can install using npm:

    $ npm install --save libp2p-webrtc-star

You can then `require()` libp2p-webrtc-star as normal:

    const libp2PWebrtcStar = require('libp2p-webrtc-star')

## In the Browser

Libp2p-webrtc-star should work in any ES2015 environment out of the box.

Usage:

    <script type="text/javascript" src="index.js"></script>

The portable versions of libp2p-webrtc-star, including `index.js` and `index.min.js`, are included in the `/dist` folder. Libp2p-webrtc-star can also be found on unpkg.com under

- https://unpkg.com/libp2p-webrtc-star/dist/index.min.js
- https://unpkg.com/libp2p-webrtc-star/dist/index.js

### WebRTCStar

src/index.js
new WebRTCStar()
Instance Members
▸ dial(ma, options)
src/index.js
dial(ma: Multiaddr, options: object): Connection
Parameters
ma `(Multiaddr)`
options `(object = `{}`)`

Name | Description
--- | ---
options.signal `AbortSignal` | Used to abort dial requests

Returns
`Connection`: An upgraded Connection
▸ createListener(options = {}, handler)
src/index.js

Creates a WebrtcStar listener. The provided `handler` function will be called anytime a new incoming Connection has been successfully upgraded via `upgrader.upgradeInbound`.

createListener(options: object?, handler: function (Connection)): Listener
Parameters
options `(object? = `{}`)` simple-peer options for listener
handler `(function (Connection))`
Returns
`Listener`: A WebrtcStar listener
▸ filter(multiaddrs)
src/index.js

Takes a list of `Multiaddr`s and returns only valid TCP addresses

filter(multiaddrs: Array<Multiaddr>): Array<Multiaddr>
Parameters
multiaddrs `(Array<Multiaddr>)`
Returns
`Array<Multiaddr>`: Valid TCP multiaddrs