You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -115,30 +115,30 @@ the same thing. Just compare the godoc of
115
115
[nhooyr/websocket](https://godoc.org/nhooyr.io/websocket) with
116
116
[gorilla/websocket](https://godoc.org/github.com/gorilla/websocket) side by side.
117
117
118
-
The API for nhooyr/websocket has been designed such that there is only one way to do things.
118
+
The API for nhooyr.io/websocket has been designed such that there is only one way to do things.
119
119
This makes it easy to use correctly. Not only is the API simpler, the implementation is
120
120
only 2200 lines whereas gorilla/websocket is at 3500 lines. That's more code to maintain,
121
121
more code to test, more code to document and more surface area for bugs.
122
122
123
-
Moreover, nhooyr/websocket supports newer Go idioms such as context.Context.
123
+
Moreover, nhooyr.io/websocket supports newer Go idioms such as context.Context.
124
124
It also uses net/http's Client and ResponseWriter directly for WebSocket handshakes.
125
125
gorilla/websocket writes its handshakes to the underlying net.Conn.
126
126
Thus it has to reinvent hooks for TLS and proxies and prevents support of HTTP/2.
127
127
128
-
Some more advantages of nhooyr/websocket are that it supports concurrent writes and
128
+
Some more advantages of nhooyr.io/websocket are that it supports concurrent writes and
129
129
makes it very easy to close the connection with a status code and reason.
130
130
131
131
The ping API is also nicer. gorilla/websocket requires registering a pong handler on the Conn
132
-
which results in awkward control flow. With nhooyr/websocket you use the Ping method on the Conn
132
+
which results in awkward control flow. With nhooyr.io/websocket you use the Ping method on the Conn
133
133
that sends a ping and also waits for the pong.
134
134
135
135
Additionally, nhooyr.io/websocket can compile to [Wasm](https://godoc.org/nhooyr.io/websocket#hdr-Wasm) for the browser.
136
136
137
-
In terms of performance, the differences mostly depend on your application code. nhooyr/websocket
137
+
In terms of performance, the differences mostly depend on your application code. nhooyr.io/websocket
138
138
reuses message buffers out of the box if you use the wsjson and wspb subpackages.
139
-
As mentioned above, nhooyr/websocket also supports concurrent writers.
139
+
As mentioned above, nhooyr.io/websocket also supports concurrent writers.
140
140
141
-
The only performance con to nhooyr/websocket is that it uses one extra goroutine to support
141
+
The only performance con to nhooyr.io/websocket is that it uses one extra goroutine to support
142
142
cancellation with context.Context. This costs 2 KB of memory which is cheap compared to
143
143
the benefits.
144
144
@@ -159,11 +159,11 @@ and clarity.
159
159
160
160
This library is fantastic in terms of performance. The author put in significant
161
161
effort to ensure its speed and I have applied as many of its optimizations as
162
-
I could into nhooyr/websocket. Definitely check out his fantastic [blog post](https://medium.freecodecamp.org/million-websockets-and-go-cc58418460bb)
162
+
I could into nhooyr.io/websocket. Definitely check out his fantastic [blog post](https://medium.freecodecamp.org/million-websockets-and-go-cc58418460bb)
163
163
about performant WebSocket servers.
164
164
165
165
If you want a library that gives you absolute control over everything, this is the library.
166
-
But for 99.9% of use cases, nhooyr/websocket will fit better. It's nearly as performant
166
+
But for 99.9% of use cases, nhooyr.io/websocket will fit better. It's nearly as performant
0 commit comments