Update README.md

This commit is contained in:
xtaci
2019-05-17 14:43:09 +08:00
committed by GitHub
parent cde199122f
commit ce5b21325d
+4 -2
View File
@@ -55,8 +55,6 @@ STREAMID:
## Usage
The API of smux are mostly taken from [yamux](https://github.com/hashicorp/yamux)
```go
func client() {
@@ -80,6 +78,8 @@ func client() {
// Stream implements io.ReadWriteCloser
stream.Write([]byte("ping"))
stream.Close()
session.Close()
}
func server() {
@@ -104,6 +104,8 @@ func server() {
// Listen for a message
buf := make([]byte, 4)
stream.Read(buf)
stream.Close()
session.Close()
}
```