Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ go get github.com/coder/websocket

See GitHub issues for minor issues but the major future enhancements are:

- [ ] Perfect examples [#217](https://github.com/nhooyr/websocket/issues/217)
- [ ] wstest.Pipe for in memory testing [#340](https://github.com/nhooyr/websocket/issues/340)
- [ ] Ping pong heartbeat helper [#267](https://github.com/nhooyr/websocket/issues/267)
- [ ] Ping pong instrumentation callbacks [#246](https://github.com/nhooyr/websocket/issues/246)
- [ ] Graceful shutdown helpers [#209](https://github.com/nhooyr/websocket/issues/209)
- [ ] Assembly for WebSocket masking [#16](https://github.com/nhooyr/websocket/issues/16)
- WIP at [#326](https://github.com/nhooyr/websocket/pull/326), about 3x faster
- [ ] HTTP/2 [#4](https://github.com/nhooyr/websocket/issues/4)
- [ ] The holy grail [#402](https://github.com/nhooyr/websocket/issues/402)
- [ ] Perfect examples [#217](https://github.com/coder/websocket/issues/217)
- [ ] wstest.Pipe for in memory testing [#340](https://github.com/coder/websocket/issues/340)
- [ ] Ping pong heartbeat helper [#267](https://github.com/coder/websocket/issues/267)
- [ ] Ping pong instrumentation callbacks [#246](https://github.com/coder/websocket/issues/246)
- [ ] Graceful shutdown helpers [#209](https://github.com/coder/websocket/issues/209)
- [ ] Assembly for WebSocket masking [#16](https://github.com/coder/websocket/issues/16)
- WIP at [#326](https://github.com/coder/websocket/pull/326), about 3x faster
- [ ] HTTP/2 [#4](https://github.com/coder/websocket/issues/4)
- [ ] The holy grail [#402](https://github.com/coder/websocket/issues/402)

## Examples

Expand Down Expand Up @@ -110,7 +110,7 @@ Advantages of [gorilla/websocket](https://github.com/gorilla/websocket):
- [Prepared writes](https://pkg.go.dev/github.com/gorilla/websocket#PreparedMessage)
- Configurable [buffer sizes](https://pkg.go.dev/github.com/gorilla/websocket#hdr-Buffers)
- No extra goroutine per connection to support cancellation with context.Context. This costs github.com/coder/websocket 2 KB of memory per connection.
- Will be removed soon with [context.AfterFunc](https://github.com/golang/go/issues/57928). See [#411](https://github.com/nhooyr/websocket/issues/411)
- Will be removed soon with [context.AfterFunc](https://github.com/golang/go/issues/57928). See [#411](https://github.com/coder/websocket/issues/411)

Advantages of github.com/coder/websocket:

Expand All @@ -128,9 +128,9 @@ Advantages of github.com/coder/websocket:
- Gorilla requires registering a pong callback before sending a Ping
- Can target Wasm ([gorilla/websocket#432](https://github.com/gorilla/websocket/issues/432))
- Transparent message buffer reuse with [wsjson](https://pkg.go.dev/github.com/coder/websocket/wsjson) subpackage
- [1.75x](https://github.com/nhooyr/websocket/releases/tag/v1.7.4) faster WebSocket masking implementation in pure Go
- [1.75x](https://github.com/coder/websocket/releases/tag/v1.7.4) faster WebSocket masking implementation in pure Go
- Gorilla's implementation is slower and uses [unsafe](https://golang.org/pkg/unsafe/).
Soon we'll have assembly and be 3x faster [#326](https://github.com/nhooyr/websocket/pull/326)
Soon we'll have assembly and be 3x faster [#326](https://github.com/coder/websocket/pull/326)
- Full [permessage-deflate](https://tools.ietf.org/html/rfc7692) compression extension support
- Gorilla only supports no context takeover mode
- [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))
Expand Down
4 changes: 2 additions & 2 deletions accept.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func accept(w http.ResponseWriter, r *http.Request, opts *AcceptOptions) (_ *Con
}

w.WriteHeader(http.StatusSwitchingProtocols)
// See https://github.com/nhooyr/websocket/issues/166
// See https://github.com/coder/websocket/issues/166
if ginWriter, ok := w.(interface {
WriteHeaderNow()
}); ok {
Expand Down Expand Up @@ -282,7 +282,7 @@ func selectDeflate(extensions []websocketExtension, mode CompressionMode) (*comp
for _, ext := range extensions {
switch ext.name {
// We used to implement x-webkit-deflate-frame too for Safari but Safari has bugs...
// See https://github.com/nhooyr/websocket/issues/218
// See https://github.com/coder/websocket/issues/218
case "permessage-deflate":
copts, ok := acceptDeflate(ext, mode)
if ok {
Expand Down
2 changes: 1 addition & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
// with an appropriate reason.
//
// This applies to context expirations as well unfortunately.
// See https://github.com/nhooyr/websocket/issues/242#issuecomment-633182220
// See https://github.com/coder/websocket/issues/242#issuecomment-633182220
type Conn struct {
noCopy noCopy

Expand Down
4 changes: 2 additions & 2 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ func ExampleConn_Ping() {

// This example demonstrates full stack chat with an automated test.
func Example_fullStackChat() {
// https://github.com/nhooyr/websocket/tree/master/internal/examples/chat
// https://github.com/coder/websocket/tree/master/internal/examples/chat
}

// This example demonstrates a echo server.
func Example_echo() {
// https://github.com/nhooyr/websocket/tree/master/internal/examples/echo
// https://github.com/coder/websocket/tree/master/internal/examples/echo
}
2 changes: 1 addition & 1 deletion mask_asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func mask(b []byte, key uint32) uint32 {
// For example, the arm64 implementation doesn't align memory like the amd64.
// Or the amd64 implementation could use AVX512 instead of just AVX2.
// The AVX2 code I had to disable anyway as it wasn't performing as expected.
// See https://github.com/nhooyr/websocket/pull/326#issuecomment-1771138049
// See https://github.com/coder/websocket/pull/326#issuecomment-1771138049
//
//go:noescape
//lint:ignore U1000 disabled till v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion netconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// It's for tunneling arbitrary protocols over WebSockets.
// Few users of the library will need this but it's tricky to implement
// correctly and so provided in the library.
// See https://github.com/nhooyr/websocket/issues/100.
// See https://github.com/coder/websocket/issues/100.
//
// Every Write to the net.Conn will correspond to a message write of
// the given type on *websocket.Conn.
Expand Down
2 changes: 1 addition & 1 deletion read.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
//
// If you need a separate timeout on the Reader call and the Read itself,
// use time.AfterFunc to cancel the context passed in.
// See https://github.com/nhooyr/websocket/issues/87#issue-451703332
// See https://github.com/coder/websocket/issues/87#issue-451703332
// Most users should not need this.
func (c *Conn) Reader(ctx context.Context) (MessageType, io.Reader, error) {
return c.reader(ctx)
Expand Down