Installable via npm install --save libp2p-websockets
, it can also be used directly in the browser.
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save libp2p-websockets
You can then require()
libp2p-websockets as normal:
const libp2PWebsockets = require('libp2p-websockets')
Libp2p-websockets should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of libp2p-websockets, including index.js
and index.min.js
, are included in the /dist
folder. Libp2p-websockets can also be found on unpkg.com under
Creates a Websockets listener. The provided handler
function will be called
anytime a new incoming Connection has been successfully upgraded via
upgrader.upgradeInbound
.
(object?
= {}
)
Name | Description |
---|---|
options.server http.Server?
|
A pre-created Node.js HTTP/S server. |
(function (Connection))
Listener
:
A Websockets listener