Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
docs: add upgrader to readme example (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun authored Sep 20, 2019
1 parent 605ee27 commit a385f0e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ const multiaddr = require('multiaddr')
const pipe = require('it-pipe')
const { collect } = require('streaming-iterables')

const addr = multiaddr('/ip4/127.0.0.1/tcp/9090')
// A simple upgrader that just returns the MultiaddrConnection
const upgrader = {
upgradeInbound: maConn => maConn,
upgradeOutbound: maConn => maConn
}

const tcp = new TCP()
const tcp = new TCP({ upgrader })

const listener = tcp.createListener((socket) => {
console.log('new connection opened')
Expand All @@ -56,6 +60,7 @@ const listener = tcp.createListener((socket) => {
)
})

const addr = multiaddr('/ip4/127.0.0.1/tcp/9090')
await listener.listen(addr)
console.log('listening')

Expand Down

0 comments on commit a385f0e

Please sign in to comment.