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
- Context based cancellation is more ergonomic and robust than setting deadlines
87
87
- No ping support because TCP keep alives work fine for HTTP/1.1 and they do not make
88
-
sense with HTTP/2 (see #1)
89
-
- net.Conn is never exposed as WebSocket's over HTTP/2 will not have a net.Conn.
90
-
- Structures are nicer than functional options, see [google/go-cloud#908](https://github.com/google/go-cloud/issues/908#issuecomment-445034143)
88
+
sense with HTTP/2 (see [#1](https://github.com/nhooyr/websocket/issues/1))
89
+
- net.Conn is never exposed as WebSocket over HTTP/2 will not have a net.Conn.
91
90
- Using net/http's Client for dialing means we do not have to reinvent dialing hooks
92
91
and configurations like other WebSocket libraries
93
92
@@ -105,7 +104,7 @@ in production.
105
104
https://github.com/gorilla/websocket
106
105
107
106
This package is the community standard but it is 6 years old and over time
108
-
has accumulated cruft. There are many ways to do the same thing, usage is not clear
107
+
has accumulated cruft. Using is not clear as there are many ways to do things
109
108
and there are some rough edges. Just compare the godoc of
110
109
[nhooyr/websocket](https://godoc.org/github.com/nhooyr/websocket) side by side with
@@ -115,11 +114,10 @@ which makes it easy to use correctly.
115
114
116
115
Furthermore, nhooyr/websocket has support for newer Go idioms such as context.Context and
117
116
also uses net/http's Client and ResponseWriter directly for WebSocket handshakes.
118
-
gorilla/websocket writes its handshakes directly to a net.Conn which means
117
+
gorilla/websocket writes its handshakes to the underlying net.Conn which means
119
118
it has to reinvent hooks for TLS and proxying and prevents support of HTTP/2.
120
119
121
-
Another advantage of nhooyr/websocket is that it supports multiple concurrent writers out
122
-
of the box.
120
+
Another advantage of nhooyr/websocket is that it supports concurrent writers out of the box.
123
121
124
122
### x/net/websocket
125
123
@@ -138,8 +136,9 @@ and clarity.
138
136
139
137
This library is fantastic in terms of performance. The author put in significant
140
138
effort to ensure its speed and I have applied as many of its optimizations as
141
-
I could into nhooyr/websocket. Definitely check out his fantastic [blog post](https://medium.freecodecamp.org/million-websockets-and-go-cc58418460bb) about performant WebSocket servers.
139
+
I could into nhooyr/websocket. Definitely check out his fantastic [blog post](https://medium.freecodecamp.org/million-websockets-and-go-cc58418460bb)
140
+
about performant WebSocket servers.
142
141
143
142
If you want a library that gives you absolute control over everything, this is the library,
144
-
but for most users, the API provided by nhooyr/websocket will fit better as it is just as
145
-
performant but much easier to use correctly and idiomatic.
143
+
but for most users, the API provided by nhooyr/websocket will fit better as it is nearly just
144
+
as performant but much easier to use correctly and idiomatic.
0 commit comments