Skip to content

Commit f76576d

Browse files
committed
Update README.md to account for state of v0.1.0
1 parent 3a01bba commit f76576d

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,26 @@ This library is in heavy development.
1111
## Install
1212

1313
```bash
14-
go get nhooyr.io/websocket@master
14+
go get nhooyr.io/websocket
1515
```
1616

1717
## Features
1818

19-
- WebSockets over HTTP/2 support
2019
- Full support of the WebSocket protocol
21-
- Only depends on the stdlib
22-
- Simple to use because of the minimal API
23-
- Uses the context package for cancellation
24-
- Uses net/http's Client to do WebSocket dials
25-
- Compression of text frames larger than 1024 bytes by default
26-
- Highly optimized where it matters
27-
- WASM support
20+
- Only depends on stdlib
21+
- Simple to use
22+
- context.Context is a first class feature
23+
- net/http is used for WebSocket dials and upgrades
2824
- Passes the [autobahn-testsuite](https://github.com/crossbario/autobahn-testsuite)
25+
- JSON helpers
26+
27+
## Roadmap
28+
29+
- [ ] WebSockets over HTTP/2 #4
30+
- [ ] Deflate extension support #5
31+
- [ ] More optimization #11
32+
- [ ] WASM #15
33+
- [ ] Ping/pongs #1
2934

3035
## Example
3136

@@ -99,11 +104,9 @@ See [example_test.go](example_test.go) for more examples.
99104
- Minimal API is easier to maintain and for others to learn
100105
- Context based cancellation is more ergonomic and robust than setting deadlines
101106
- No pings or pongs because TCP keep alives work fine for HTTP/1.1 and they do not make
102-
sense with HTTP/2
107+
sense with HTTP/2 (see #1)
103108
- net.Conn is never exposed as WebSocket's over HTTP/2 will not have a net.Conn.
104109
- Functional options make the API very clean and easy to extend
105-
- Compression is very useful for JSON payloads
106-
- JSON helpers make code terse
107110
- Using net/http's Client for dialing means we do not have to reinvent dialing hooks
108111
and configurations. Just pass in a custom net/http client if you want custom dialing.
109112

@@ -126,6 +129,15 @@ is not clear. Just compare the godoc of
126129
The API for nhooyr/websocket has been designed such that there is only one way to do things
127130
which makes using it correctly and safely much easier.
128131

132+
In terms of lines of code, this library is around 2000 whereas gorilla/websocket is
133+
at 7000. So while the API for nhooyr/websocket is simpler, the implementation is also
134+
significantly simpler and easier to test which reduces the surface are of bugs.
135+
136+
Furthermore, nhooyr/websocket has support for newer Go idioms such as context.Context and
137+
also uses net/http's Client and ResponseWriter directly for WebSocket handshakes.
138+
gorilla/websocket writes its handshakes directly to a net.Conn which means
139+
it has to reinvent hooks for TLS and proxying and prevents support of HTTP/2.
140+
129141
### x/net/websocket
130142

131143
https://godoc.org/golang.org/x/net/websocket

0 commit comments

Comments
 (0)