Skip to content

Commit 1c4fdf2

Browse files
committed
Clarify gorilla/websocket comparison
1 parent 80ac847 commit 1c4fdf2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ which makes it easy to use correctly. Not only is the API simpler, the implement
113113
only 1700 lines whereas gorilla/websocket is at 3500 lines. That's more code to maintain,
114114
more code to test, more code to document and more surface area for bugs.
115115

116-
The future of gorilla/websocket is also uncertain. See [gorilla/websocket#370](https://github.com/gorilla/websocket/issues/370).
117-
118116
Moreover, nhooyr/websocket has support for newer Go idioms such as context.Context and
119117
also uses net/http's Client and ResponseWriter directly for WebSocket handshakes.
120118
gorilla/websocket writes its handshakes to the underlying net.Conn which means
@@ -123,7 +121,7 @@ it has to reinvent hooks for TLS and proxies and prevents support of HTTP/2.
123121
Some more advantages of nhooyr/websocket are that it supports concurrent writes and
124122
makes it very easy to close the connection with a status code and reason.
125123

126-
The ping API is also much nicer. gorilla/websocket requires registering a pong handler on the Conn
124+
The ping API is also nicer. gorilla/websocket requires registering a pong handler on the Conn
127125
which results in awkward control flow. With nhooyr/websocket you use the Ping method on the Conn
128126
that sends a ping and also waits for the pong.
129127

@@ -132,8 +130,8 @@ reuses message buffers out of the box if you use the wsjson and wspb subpackages
132130
As mentioned above, nhooyr/websocket also supports concurrent writers.
133131

134132
The only performance con to nhooyr/websocket is that uses one extra goroutine to support
135-
cancellation with context.Context and the net/http client side body upgrade.
136-
This costs 2 KB of memory which is cheap compared to simplicity benefits.
133+
cancellation with context.Context. This costs 2 KB of memory which is cheap compared to
134+
simplicity benefits.
137135

138136
### x/net/websocket
139137

0 commit comments

Comments
 (0)