Skip to content

Commit 9d9f8a9

Browse files
committed
Improve echo server example
1 parent d46a552 commit 9d9f8a9

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if err != nil {
7171
}
7272
```
7373

74-
For a production quality example that shows off the low level API, see the [echo example](https://github.com/nhooyr/websocket/blob/7518ba4d5413de6c0f9a77f0166636c796d17bfb/example_test.go#L15-L78).
74+
For a production quality example that shows off the low level API, see the [echo server example](https://github.com/nhooyr/websocket/blob/master/example_test.go#L15).
7575

7676
### Client
7777

example_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,14 @@ func ExampleAccept_echo() {
4343
}
4444

4545
err = w.Close()
46-
if err != nil {
47-
return err
48-
}
49-
50-
return nil
46+
return err
5147
}
5248

5349
l := rate.NewLimiter(rate.Every(time.Millisecond*100), 10)
5450
for l.Allow() {
5551
err := echo()
5652
if err != nil {
57-
log.Printf("failed to read message: %v", err)
53+
log.Printf("failed to echo message: %v", err)
5854
return
5955
}
6056
}

0 commit comments

Comments
 (0)