Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.
/ js-libp2p-spdy Public archive

SPDY 3.1 implementation wrapper that is compatible with libp2p Stream Muxer expected interface

License

Notifications You must be signed in to change notification settings

libp2p/js-libp2p-spdy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-libp2p-spdy

Coverage Status Dependency Status Travis CI Circle CI js-standard-style

SPDY 3.1 implementation wrapper that is compatible with libp2p Stream Muxer expected interface

Installation

npm

> npm i libp2p-spdy

Use in Node.js

const spdy = require('libp2p-spdy')

Use in a browser with browserify, webpack or any other bundler

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')

Use in a browser Using a script tag

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>

Usage

API

Attaching it to a socket (duplex stream)

As a listener

const listener = spdy(socket, true)

As a dialer

const dialer = spdy(socket, false)

Opening a multiplex duplex stream

const conn = dialer.newStream((err, conn) => {})

conn.on('error', (err) => {})

note: Works the same on the listener side

Receiving incoming stream

dialer.on('stream', (conn) => {})

note: Works the same on the listener side

Close

dialer.close()

note: Works the same on the listener side

Other events

dialer.on('close', () => {})
dialer.on('error', () => {})

note: Works the same on the listener side

About

SPDY 3.1 implementation wrapper that is compatible with libp2p Stream Muxer expected interface

Resources

License

Stars

Watchers

Forks

Packages

No packages published