Skip to content

Commit e2a32fc

Browse files
committed
Compare against existing libraries in README.md
1 parent 00ca8fe commit e2a32fc

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,32 @@ This library is in heavy development.
1313
```bash
1414
go get nhooyr.io/ws
1515
```
16+
17+
## Why
18+
19+
There is no other Go WebSocket library with a clean API.
20+
21+
Comparisons with existing WebSocket libraries below.
22+
23+
### [x/net/websocket](https://godoc.org/golang.org/x/net/websocket)
24+
25+
26+
Unmaintained and the API does not reflect WebSocket semantics.
27+
28+
See https://github.com/golang/go/issues/18152
29+
30+
### [gorilla/websocket](https://github.com/gorilla/websocket)
31+
32+
This package is the community standard but it is very old and over time
33+
has accumulated cruft. There are many ways to do the same thing and the API
34+
overall is just not very clear.
35+
36+
The callback hooks are also confusing. The API for this library has been designed
37+
such that there is only one way to do things and callbacks have been avoided.
38+
39+
Performance sensitive applications should use ws/wscore directly.
40+
41+
## [gobwas/ws](https://github.com/gobwas/ws)
42+
43+
This library has an extremely flexible API but that comes at a cost of usability
44+
and clarity. Its just not clear and simple how to do things in a safe manner.

ws.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func (c *Conn) NetConn() net.Conn {
2727
// MessageWriter returns a writer bounded by the context that will write
2828
// a WebSocket data frame of type dataType to the connection.
2929
// Ensure you close the MessageWriter once you have written to entire message.
30+
// Concurrent calls to MessageWriter are ok.
3031
func (c *Conn) MessageWriter(ctx context.Context, dataType DataType) *MessageWriter {
3132
panic("TODO")
3233
}

0 commit comments

Comments
 (0)