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.
13
13
``` bash
14
14
go get nhooyr.io/ws
15
15
```
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 {
27
27
// MessageWriter returns a writer bounded by the context that will write
28
28
// a WebSocket data frame of type dataType to the connection.
29
29
// Ensure you close the MessageWriter once you have written to entire message.
30
+ // Concurrent calls to MessageWriter are ok.
30
31
func (c * Conn ) MessageWriter (ctx context.Context , dataType DataType ) * MessageWriter {
31
32
panic ("TODO" )
32
33
}
You can’t perform that action at this time.
0 commit comments