SPDY 3.1 implementation wrapper that is compatible with libp2p Stream Muxer expected interface
> npm i libp2p-spdy
const spdy = require('libp2p-spdy')
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
var spdy = require('libp2p-spdy')
Loading this module through a script tag will make the Lip2pSpdy
obj available in the global namespace.
<script src="https://npmcdn.com/libp2p-spdy/dist/index.min.js"></script>
<!-- OR -->
<script src="https://npmcdn.com/libp2p-spdy/dist/index.js"></script>
As a listener
const listener = spdy(socket, true)
As a dialer
const dialer = spdy(socket, false)
const conn = dialer.newStream((err, conn) => {})
conn.on('error', (err) => {})
note: Works the same on the listener side
dialer.on('stream', (conn) => {})
note: Works the same on the listener side
dialer.close()
note: Works the same on the listener side
dialer.on('close', () => {})
dialer.on('error', () => {})
note: Works the same on the listener side