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
- No extra goroutine per connection to support cancellation with context.Context. This costs nhooyr.io/websocket 2 KB of memory per connection.
110
+
- No extra goroutine per connection to support cancellation with context.Context. This costs github.com/coder/websocket 2 KB of memory per connection.
106
111
- Will be removed soon with [context.AfterFunc](https://github.com/golang/go/issues/57928). See [#411](https://github.com/nhooyr/websocket/issues/411)
107
112
108
-
Advantages of nhooyr.io/websocket:
113
+
Advantages of github.com/coder/websocket:
109
114
110
115
- Minimal and idiomatic API
111
-
- Compare godoc of [nhooyr.io/websocket](https://pkg.go.dev/nhooyr.io/websocket) with [gorilla/websocket](https://pkg.go.dev/github.com/gorilla/websocket) side by side.
- Compare godoc of [github.com/coder/websocket](https://pkg.go.dev/github.com/coder/websocket) with [gorilla/websocket](https://pkg.go.dev/github.com/gorilla/websocket) side by side.
- Gorilla writes directly to a net.Conn and so duplicates features of net/http.Client.
118
123
- Concurrent writes
119
124
- Close handshake ([gorilla/websocket#448](https://github.com/gorilla/websocket/issues/448))
120
-
- Idiomatic [ping pong](https://pkg.go.dev/nhooyr.io/websocket#Conn.Ping) API
125
+
- Idiomatic [ping pong](https://pkg.go.dev/github.com/coder/websocket#Conn.Ping) API
121
126
- Gorilla requires registering a pong callback before sending a Ping
122
127
- Can target Wasm ([gorilla/websocket#432](https://github.com/gorilla/websocket/issues/432))
123
-
- Transparent message buffer reuse with [wsjson](https://pkg.go.dev/nhooyr.io/websocket/wsjson) subpackage
128
+
- Transparent message buffer reuse with [wsjson](https://pkg.go.dev/github.com/coder/websocket/wsjson) subpackage
124
129
-[1.75x](https://github.com/nhooyr/websocket/releases/tag/v1.7.4) faster WebSocket masking implementation in pure Go
125
130
- Gorilla's implementation is slower and uses [unsafe](https://golang.org/pkg/unsafe/).
126
131
Soon we'll have assembly and be 3x faster [#326](https://github.com/nhooyr/websocket/pull/326)
127
132
- Full [permessage-deflate](https://tools.ietf.org/html/rfc7692) compression extension support
128
133
- Gorilla only supports no context takeover mode
129
-
-[CloseRead](https://pkg.go.dev/nhooyr.io/websocket#Conn.CloseRead) helper for write only connections ([gorilla/websocket#492](https://github.com/gorilla/websocket/issues/492))
134
+
-[CloseRead](https://pkg.go.dev/github.com/coder/websocket#Conn.CloseRead) helper for write only connections ([gorilla/websocket#492](https://github.com/gorilla/websocket/issues/492))
130
135
131
136
#### golang.org/x/net/websocket
132
137
133
138
[golang.org/x/net/websocket](https://pkg.go.dev/golang.org/x/net/websocket) is deprecated.
134
139
See [golang/go/issues/18152](https://github.com/golang/go/issues/18152).
135
140
136
-
The [net.Conn](https://pkg.go.dev/nhooyr.io/websocket#NetConn) can help in transitioning
137
-
to nhooyr.io/websocket.
141
+
The [net.Conn](https://pkg.go.dev/github.com/coder/websocket#NetConn) can help in transitioning
142
+
to github.com/coder/websocket.
138
143
139
144
#### gobwas/ws
140
145
@@ -143,7 +148,7 @@ in an event driven style for performance. See the author's [blog post](https://m
143
148
144
149
However it is quite bloated. See https://pkg.go.dev/github.com/gobwas/ws
145
150
146
-
When writing idiomatic Go, nhooyr.io/websocket will be faster and easier to use.
151
+
When writing idiomatic Go, github.com/coder/websocket will be faster and easier to use.
147
152
148
153
#### lesismal/nbio
149
154
@@ -152,4 +157,4 @@ event driven for performance reasons.
152
157
153
158
However it is quite bloated. See https://pkg.go.dev/github.com/lesismal/nbio
154
159
155
-
When writing idiomatic Go, nhooyr.io/websocket will be faster and easier to use.
160
+
When writing idiomatic Go, github.com/coder/websocket will be faster and easier to use.
0 commit comments