File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,32 @@ This library is in heavy development.
1313``` bash
1414go 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.
Original file line number Diff line number Diff 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.
3031func (c * Conn ) MessageWriter (ctx context.Context , dataType DataType ) * MessageWriter {
3132 panic ("TODO" )
3233}
You can’t perform that action at this time.
0 commit comments