docs: update transport example (#1268)

This commit is contained in:
Konosuke Kachi 2022-07-16 00:27:26 +09:00 committed by GitHub
parent 750ed9c35f
commit 6eaab2e3ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ function print ({ stream }) {
)
}
;(async () => {
(async () => {
const [node1, node2, node3] = await Promise.all([
createNode([new TCP()], '/ip4/0.0.0.0/tcp/0'),
createNode([new TCP(), new WebSockets()], ['/ip4/0.0.0.0/tcp/0', '/ip4/127.0.0.1/tcp/10000/ws']),
@ -69,7 +69,7 @@ function print ({ stream }) {
stream
)
// node 2 (TCP+WebSockets) dials to node 2 (WebSockets)
// node 2 (TCP+WebSockets) dials to node 3 (WebSockets)
const stream2 = await node2.dialProtocol(node3.peerId, '/print')
await pipe(
[uint8ArrayFromString('node 2 dialed to node 3 successfully')],

View File

@ -121,7 +121,7 @@ function printAddrs (node, number) {
Then add,
```js
;(async () => {
(async () => {
const [node1, node2] = await Promise.all([
createNode(),
createNode()
@ -231,7 +231,7 @@ await pipe(
stream
)
// node 2 (TCP+WebSockets) dials to node 2 (WebSockets)
// node 2 (TCP+WebSockets) dials to node 3 (WebSockets)
const stream2 = await node2.dialProtocol(node3.peerId, '/print')
await pipe(
['node 2 dialed to node 3 successfully'],