|
3 | 3 | [](http://libp2p.io/)
|
4 | 4 | [](https://discuss.libp2p.io)
|
5 | 5 | [](https://codecov.io/gh/libp2p/js-libp2p-websockets)
|
6 |
| -[](https://github.com/libp2p/js-libp2p-websockets/actions/workflows/js-test-and-release.yml) |
| 6 | +[](https://github.com/libp2p/js-libp2p-websockets/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) |
7 | 7 |
|
8 | 8 | > JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec
|
9 | 9 |
|
10 | 10 | ## Table of contents <!-- omit in toc -->
|
11 | 11 |
|
12 | 12 | - [Install](#install)
|
| 13 | + - [Browser `<script>` tag](#browser-script-tag) |
13 | 14 | - [Usage](#usage)
|
14 | 15 | - [Constructor properties](#constructor-properties)
|
15 | 16 | - [Libp2p Usage Example](#libp2p-usage-example)
|
16 | 17 | - [API](#api)
|
17 | 18 | - [Transport](#transport)
|
18 | 19 | - [Connection](#connection)
|
| 20 | +- [API Docs](#api-docs) |
19 | 21 | - [License](#license)
|
20 | 22 | - [Contribute](#contribute)
|
21 | 23 |
|
|
25 | 27 | $ npm i @libp2p/websockets
|
26 | 28 | ```
|
27 | 29 |
|
| 30 | +### Browser `<script>` tag |
| 31 | + |
| 32 | +Loading this module through a script tag will make it's exports available as `Libp2pWebsockets` in the global namespace. |
| 33 | + |
| 34 | +```html |
| 35 | +<script src="https://unpkg.com/@libp2p/websockets/dist/index.min.js"></script> |
| 36 | +``` |
| 37 | + |
28 | 38 | [](https://github.com/libp2p/interface-transport)
|
29 | 39 | [](https://github.com/libp2p/interface-connection)
|
30 | 40 |
|
@@ -53,7 +63,7 @@ await node.dial('/ip4/127.0.0.1/tcp/9090/ws')
|
53 | 63 | | Name | Type | Description | Default |
|
54 | 64 | | -------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------- |
|
55 | 65 | | upgrader | [`Upgrader`](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/transport#upgrader) | connection upgrader object with `upgradeOutbound` and `upgradeInbound` | **REQUIRED** |
|
56 |
| -| filter | `(multiaddrs: Array<Multiaddr>) => Array<Multiaddr>` | override transport addresses filter | **Browser:** DNS+WSS multiaddrs / **Node.js:** DNS+{WS, WSS} multiaddrs | |
| 66 | +| filter | `(multiaddrs: Array<Multiaddr>) => Array<Multiaddr>` | override transport addresses filter | **Browser:** DNS+WSS multiaddrs / **Node.js:** DNS+[WS, WSS] multiaddrs | |
57 | 67 |
|
58 | 68 | You can create your own address filters for this transports, or rely in the filters [provided](./src/filters.js).
|
59 | 69 |
|
@@ -104,6 +114,10 @@ For more information see [libp2p/js-libp2p/doc/CONFIGURATION.md#customizing-tran
|
104 | 114 |
|
105 | 115 | [](https://github.com/libp2p/interface-connection)
|
106 | 116 |
|
| 117 | +## API Docs |
| 118 | + |
| 119 | +- <https://libp2p.github.io/js-libp2p-websockets> |
| 120 | + |
107 | 121 | ## License
|
108 | 122 |
|
109 | 123 | Licensed under either of
|
|
0 commit comments