Skip to content

Commit 1776fa1

Browse files
committed
Add Stop() documentation
1 parent 97cb101 commit 1776fa1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ type Listener struct {
144144
SocketListener net.Listener
145145
HasNewMessages func() bool
146146
GetMessage func() string
147+
Stop func()
147148
}
148149
```
149150
@@ -177,6 +178,22 @@ func main() {
177178
}
178179
```
179180
181+
`Stop()` function closes the listener connection:
182+
183+
```go
184+
func main() {
185+
r, _ := hare.Listen("3000")
186+
hare.Send("3000", "Hey beauty")
187+
188+
r.Stop()
189+
190+
err := Send("3000", "This should fails")
191+
if err != nil {
192+
panic(err)
193+
}
194+
}
195+
```
196+
180197
## Examples
181198
182199
You can check the [example](./examples) for code usages, like [send](./examples/send.go) and [listen](./examples/listen.go) samples.

0 commit comments

Comments
 (0)