You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onStream:stream=> { // Receive a duplex stream from the remote
@@ -63,7 +63,7 @@ pipe([1, 2, 3], stream)
63
63
64
64
## API
65
65
66
-
### `const factory = new Mplex([options])`
66
+
### `const factory = mplex([options])`
67
67
68
68
Creates a factory that can be used to create new muxers.
69
69
@@ -84,11 +84,11 @@ Create a new *duplex* stream that can be piped together with a connection in ord
84
84
e.g.
85
85
86
86
```js
87
-
import { Mplex } from'@libp2p/mplex'
87
+
import { mplex } from'@libp2p/mplex'
88
88
import { pipe } from'it-pipe'
89
89
90
90
// Create a duplex muxer
91
-
constmuxer=newMplex()
91
+
constmuxer=mplex()
92
92
93
93
// Use the muxer in a pipeline
94
94
pipe(conn, muxer, conn) // conn is duplex connection to another peer
@@ -109,12 +109,12 @@ pipe(conn, muxer, conn) // conn is duplex connection to another peer
109
109
stream
110
110
)
111
111
}
112
-
constmuxer=newMplex({ onStream })
112
+
constmuxer=mplex({ onStream })
113
113
// ...
114
114
```
115
115
**Note:** The `onStream` function can be passed in place of the `options` object. i.e.
116
116
```js
117
-
newMplex(stream=> { /* ... */ })
117
+
mplex(stream=> { /* ... */ })
118
118
```
119
119
-`onStreamEnd` - A function called when a stream ends
120
120
```js
@@ -128,7 +128,7 @@ pipe(conn, muxer, conn) // conn is duplex connection to another peer
128
128
-`signal` - An [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) which can be used to abort the muxer, *including* all of it's multiplexed connections. e.g.
0 commit comments