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

Commit a385f0e

Browse files
authored
docs: add upgrader to readme example (#114)
1 parent 605ee27 commit a385f0e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ const multiaddr = require('multiaddr')
4444
const pipe = require('it-pipe')
4545
const { collect } = require('streaming-iterables')
4646

47-
const addr = multiaddr('/ip4/127.0.0.1/tcp/9090')
47+
// A simple upgrader that just returns the MultiaddrConnection
48+
const upgrader = {
49+
upgradeInbound: maConn => maConn,
50+
upgradeOutbound: maConn => maConn
51+
}
4852

49-
const tcp = new TCP()
53+
const tcp = new TCP({ upgrader })
5054

5155
const listener = tcp.createListener((socket) => {
5256
console.log('new connection opened')
@@ -56,6 +60,7 @@ const listener = tcp.createListener((socket) => {
5660
)
5761
})
5862

63+
const addr = multiaddr('/ip4/127.0.0.1/tcp/9090')
5964
await listener.listen(addr)
6065
console.log('listening')
6166

0 commit comments

Comments
 (0)