28 lines
1.1 KiB
Markdown
28 lines
1.1 KiB
Markdown
# go-mplex
|
|
|
|
[](https://protocol.ai)
|
|
[](https://pkg.go.dev/github.com/libp2p/go-mplex)
|
|
[](https://libp2p.io/)
|
|
[](http://webchat.freenode.net/?channels=%23libp2p)
|
|
[](https://discuss.libp2p.io)
|
|
|
|
A super simple [stream muxing](https://docs.libp2p.io/concepts/stream-multiplexing/) library implementing [mplex](https://github.com/libp2p/specs/tree/master/mplex).
|
|
|
|
## Usage
|
|
|
|
```go
|
|
mplex := multiplex.NewMultiplex(mysocket)
|
|
|
|
s, _ := mplex.NewStream()
|
|
s.Write([]byte("Hello World!"))
|
|
s.Close()
|
|
|
|
os, _ := mplex.Accept()
|
|
// echo back everything received
|
|
io.Copy(os, os)
|
|
```
|
|
|
|
---
|
|
|
|
The last gx published version of this module was: 0.2.35: QmWGQQ6Tz8AdUpxktLf3zgnVN9Vy8fcWVezZJSU3ZmiANj
|