Skip to content

Commit 7737a2e

Browse files
authored
Merge pull request #462 from coder/update-import
Update import path to github.com/coder/websocket
2 parents bd07a64 + 782e5d2 commit 7737a2e

38 files changed

+99
-101
lines changed

.github/workflows/ci.yml

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- run: go version
2222
- uses: actions/setup-go@v5
23-
with:
24-
go-version-file: ./go.mod
2523
- run: ./ci/lint.sh
2624

2725
test:

README.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# websocket
22

3-
[![Go Reference](https://pkg.go.dev/badge/nhooyr.io/websocket.svg)](https://pkg.go.dev/nhooyr.io/websocket)
4-
[![Go Coverage](https://img.shields.io/badge/coverage-91%25-success)](https://nhooyr.io/websocket/coverage.html)
3+
[![Go Reference](https://pkg.go.dev/badge/github.com/coder/websocket.svg)](https://pkg.go.dev/github.com/coder/websocket)
4+
[![Go Coverage](https://img.shields.io/badge/coverage-91%25-success)](https://github.com/coder/websocket/coverage.html)
55

66
websocket is a minimal and idiomatic WebSocket library for Go.
77

88
## Install
99

1010
```sh
11-
go get nhooyr.io/websocket
11+
go get github.com/coder/websocket
1212
```
1313

1414
## Highlights
1515

1616
- Minimal and idiomatic API
1717
- First class [context.Context](https://blog.golang.org/context) support
1818
- Fully passes the WebSocket [autobahn-testsuite](https://github.com/crossbario/autobahn-testsuite)
19-
- [Zero dependencies](https://pkg.go.dev/nhooyr.io/websocket?tab=imports)
20-
- JSON helpers in the [wsjson](https://pkg.go.dev/nhooyr.io/websocket/wsjson) subpackage
19+
- [Zero dependencies](https://pkg.go.dev/github.com/coder/websocket?tab=imports)
20+
- JSON helpers in the [wsjson](https://pkg.go.dev/github.com/coder/websocket/wsjson) subpackage
2121
- Zero alloc reads and writes
2222
- Concurrent writes
23-
- [Close handshake](https://pkg.go.dev/nhooyr.io/websocket#Conn.Close)
24-
- [net.Conn](https://pkg.go.dev/nhooyr.io/websocket#NetConn) wrapper
25-
- [Ping pong](https://pkg.go.dev/nhooyr.io/websocket#Conn.Ping) API
23+
- [Close handshake](https://pkg.go.dev/github.com/coder/websocket#Conn.Close)
24+
- [net.Conn](https://pkg.go.dev/github.com/coder/websocket#NetConn) wrapper
25+
- [Ping pong](https://pkg.go.dev/github.com/coder/websocket#Conn.Ping) API
2626
- [RFC 7692](https://tools.ietf.org/html/rfc7692) permessage-deflate compression
27-
- [CloseRead](https://pkg.go.dev/nhooyr.io/websocket#Conn.CloseRead) helper for write only connections
28-
- Compile to [Wasm](https://pkg.go.dev/nhooyr.io/websocket#hdr-Wasm)
27+
- [CloseRead](https://pkg.go.dev/github.com/coder/websocket#Conn.CloseRead) helper for write only connections
28+
- Compile to [Wasm](https://pkg.go.dev/github.com/coder/websocket#hdr-Wasm)
2929

3030
## Roadmap
3131

@@ -102,39 +102,39 @@ Advantages of [gorilla/websocket](https://github.com/gorilla/websocket):
102102
- Mature and widely used
103103
- [Prepared writes](https://pkg.go.dev/github.com/gorilla/websocket#PreparedMessage)
104104
- Configurable [buffer sizes](https://pkg.go.dev/github.com/gorilla/websocket#hdr-Buffers)
105-
- No extra goroutine per connection to support cancellation with context.Context. This costs nhooyr.io/websocket 2 KB of memory per connection.
105+
- No extra goroutine per connection to support cancellation with context.Context. This costs github.com/coder/websocket 2 KB of memory per connection.
106106
- Will be removed soon with [context.AfterFunc](https://github.com/golang/go/issues/57928). See [#411](https://github.com/nhooyr/websocket/issues/411)
107107

108-
Advantages of nhooyr.io/websocket:
108+
Advantages of github.com/coder/websocket:
109109

110110
- 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.
112-
- [net.Conn](https://pkg.go.dev/nhooyr.io/websocket#NetConn) wrapper
111+
- 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.
112+
- [net.Conn](https://pkg.go.dev/github.com/coder/websocket#NetConn) wrapper
113113
- Zero alloc reads and writes ([gorilla/websocket#535](https://github.com/gorilla/websocket/issues/535))
114114
- Full [context.Context](https://blog.golang.org/context) support
115115
- Dial uses [net/http.Client](https://golang.org/pkg/net/http/#Client)
116116
- Will enable easy HTTP/2 support in the future
117117
- Gorilla writes directly to a net.Conn and so duplicates features of net/http.Client.
118118
- Concurrent writes
119119
- 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
120+
- Idiomatic [ping pong](https://pkg.go.dev/github.com/coder/websocket#Conn.Ping) API
121121
- Gorilla requires registering a pong callback before sending a Ping
122122
- 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
123+
- Transparent message buffer reuse with [wsjson](https://pkg.go.dev/github.com/coder/websocket/wsjson) subpackage
124124
- [1.75x](https://github.com/nhooyr/websocket/releases/tag/v1.7.4) faster WebSocket masking implementation in pure Go
125125
- Gorilla's implementation is slower and uses [unsafe](https://golang.org/pkg/unsafe/).
126126
Soon we'll have assembly and be 3x faster [#326](https://github.com/nhooyr/websocket/pull/326)
127127
- Full [permessage-deflate](https://tools.ietf.org/html/rfc7692) compression extension support
128128
- 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))
129+
- [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))
130130

131131
#### golang.org/x/net/websocket
132132

133133
[golang.org/x/net/websocket](https://pkg.go.dev/golang.org/x/net/websocket) is deprecated.
134134
See [golang/go/issues/18152](https://github.com/golang/go/issues/18152).
135135

136-
The [net.Conn](https://pkg.go.dev/nhooyr.io/websocket#NetConn) can help in transitioning
137-
to nhooyr.io/websocket.
136+
The [net.Conn](https://pkg.go.dev/github.com/coder/websocket#NetConn) can help in transitioning
137+
to github.com/coder/websocket.
138138

139139
#### gobwas/ws
140140

@@ -143,7 +143,7 @@ in an event driven style for performance. See the author's [blog post](https://m
143143

144144
However it is quite bloated. See https://pkg.go.dev/github.com/gobwas/ws
145145

146-
When writing idiomatic Go, nhooyr.io/websocket will be faster and easier to use.
146+
When writing idiomatic Go, github.com/coder/websocket will be faster and easier to use.
147147

148148
#### lesismal/nbio
149149

@@ -152,4 +152,4 @@ event driven for performance reasons.
152152

153153
However it is quite bloated. See https://pkg.go.dev/github.com/lesismal/nbio
154154

155-
When writing idiomatic Go, nhooyr.io/websocket will be faster and easier to use.
155+
When writing idiomatic Go, github.com/coder/websocket will be faster and easier to use.

accept.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"path/filepath"
1818
"strings"
1919

20-
"nhooyr.io/websocket/internal/errd"
20+
"github.com/coder/websocket/internal/errd"
2121
)
2222

2323
// AcceptOptions represents Accept's options.

accept_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"sync"
1414
"testing"
1515

16-
"nhooyr.io/websocket/internal/test/assert"
17-
"nhooyr.io/websocket/internal/test/xrand"
16+
"github.com/coder/websocket/internal/test/assert"
17+
"github.com/coder/websocket/internal/test/xrand"
1818
)
1919

2020
func TestAccept(t *testing.T) {

autobahn_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import (
1717
"testing"
1818
"time"
1919

20-
"nhooyr.io/websocket"
21-
"nhooyr.io/websocket/internal/errd"
22-
"nhooyr.io/websocket/internal/test/assert"
23-
"nhooyr.io/websocket/internal/test/wstest"
24-
"nhooyr.io/websocket/internal/util"
20+
"github.com/coder/websocket"
21+
"github.com/coder/websocket/internal/errd"
22+
"github.com/coder/websocket/internal/test/assert"
23+
"github.com/coder/websocket/internal/test/wstest"
24+
"github.com/coder/websocket/internal/util"
2525
)
2626

2727
var excludedAutobahnCases = []string{

close.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"net"
1212
"time"
1313

14-
"nhooyr.io/websocket/internal/errd"
14+
"github.com/coder/websocket/internal/errd"
1515
)
1616

1717
// StatusCode represents a WebSocket status code.

close_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
"testing"
1111

12-
"nhooyr.io/websocket/internal/test/assert"
12+
"github.com/coder/websocket/internal/test/assert"
1313
)
1414

1515
func TestCloseError(t *testing.T) {

compress_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"strings"
1111
"testing"
1212

13-
"nhooyr.io/websocket/internal/test/assert"
14-
"nhooyr.io/websocket/internal/test/xrand"
13+
"github.com/coder/websocket/internal/test/assert"
14+
"github.com/coder/websocket/internal/test/xrand"
1515
)
1616

1717
func Test_slidingWindow(t *testing.T) {

conn_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import (
1616
"testing"
1717
"time"
1818

19-
"nhooyr.io/websocket"
20-
"nhooyr.io/websocket/internal/errd"
21-
"nhooyr.io/websocket/internal/test/assert"
22-
"nhooyr.io/websocket/internal/test/wstest"
23-
"nhooyr.io/websocket/internal/test/xrand"
24-
"nhooyr.io/websocket/internal/xsync"
25-
"nhooyr.io/websocket/wsjson"
19+
"github.com/coder/websocket"
20+
"github.com/coder/websocket/internal/errd"
21+
"github.com/coder/websocket/internal/test/assert"
22+
"github.com/coder/websocket/internal/test/wstest"
23+
"github.com/coder/websocket/internal/test/xrand"
24+
"github.com/coder/websocket/internal/xsync"
25+
"github.com/coder/websocket/wsjson"
2626
)
2727

2828
func TestConn(t *testing.T) {

dial.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"sync"
1818
"time"
1919

20-
"nhooyr.io/websocket/internal/errd"
20+
"github.com/coder/websocket/internal/errd"
2121
)
2222

2323
// DialOptions represents Dial's options.

dial_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import (
1515
"testing"
1616
"time"
1717

18-
"nhooyr.io/websocket"
19-
"nhooyr.io/websocket/internal/test/assert"
20-
"nhooyr.io/websocket/internal/util"
21-
"nhooyr.io/websocket/internal/xsync"
18+
"github.com/coder/websocket"
19+
"github.com/coder/websocket/internal/test/assert"
20+
"github.com/coder/websocket/internal/util"
21+
"github.com/coder/websocket/internal/xsync"
2222
)
2323

2424
func TestBadDials(t *testing.T) {

doc.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//
1616
// The wsjson subpackage contain helpers for JSON and protobuf messages.
1717
//
18-
// More documentation at https://nhooyr.io/websocket.
18+
// More documentation at https://github.com/coder/websocket.
1919
//
2020
// # Wasm
2121
//
@@ -31,4 +31,4 @@
3131
// - Conn.CloseNow is Close(StatusGoingAway, "")
3232
// - HTTPClient, HTTPHeader and CompressionMode in DialOptions are no-op
3333
// - *http.Response from Dial is &http.Response{} with a 101 status code on success
34-
package websocket // import "nhooyr.io/websocket"
34+
package websocket // import "github.com/coder/websocket"

example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"net/http"
77
"time"
88

9-
"nhooyr.io/websocket"
10-
"nhooyr.io/websocket/wsjson"
9+
"github.com/coder/websocket"
10+
"github.com/coder/websocket/wsjson"
1111
)
1212

1313
func ExampleAccept() {

export_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package websocket
66
import (
77
"net"
88

9-
"nhooyr.io/websocket/internal/util"
9+
"github.com/coder/websocket/internal/util"
1010
)
1111

1212
func (c *Conn) RecordBytesWritten() *int {

frame.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"io"
1010
"math"
1111

12-
"nhooyr.io/websocket/internal/errd"
12+
"github.com/coder/websocket/internal/errd"
1313
)
1414

1515
// opcode represents a WebSocket opcode.

frame_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"testing"
1414
"time"
1515

16-
"nhooyr.io/websocket/internal/test/assert"
16+
"github.com/coder/websocket/internal/test/assert"
1717
)
1818

1919
func TestHeader(t *testing.T) {

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module nhooyr.io/websocket
1+
module github.com/coder/websocket
22

33
go 1.19

internal/examples/chat/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Chat Example
22

3-
This directory contains a full stack example of a simple chat webapp using nhooyr.io/websocket.
3+
This directory contains a full stack example of a simple chat webapp using github.com/coder/websocket.
44

55
```bash
66
$ cd examples/chat

internal/examples/chat/chat.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"golang.org/x/time/rate"
1414

15-
"nhooyr.io/websocket"
15+
"github.com/coder/websocket"
1616
)
1717

1818
// chatServer enables broadcasting to a set of subscribers.

internal/examples/chat/chat_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
"golang.org/x/time/rate"
1616

17-
"nhooyr.io/websocket"
17+
"github.com/coder/websocket"
1818
)
1919

2020
func Test_chatServer(t *testing.T) {

internal/examples/chat/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en-CA">
33
<head>
44
<meta charset="UTF-8" />
5-
<title>nhooyr.io/websocket - Chat Example</title>
5+
<title>github.com/coder/websocket - Chat Example</title>
66
<meta name="viewport" content="width=device-width" />
77

88
<link href="https://unpkg.com/sanitize.css" rel="stylesheet" />

internal/examples/echo/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Echo Example
22

3-
This directory contains a echo server example using nhooyr.io/websocket.
3+
This directory contains a echo server example using github.com/coder/websocket.
44

55
```bash
66
$ cd examples/echo

internal/examples/echo/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
"golang.org/x/time/rate"
1111

12-
"nhooyr.io/websocket"
12+
"github.com/coder/websocket"
1313
)
1414

1515
// echoServer is the WebSocket echo server implementation.

internal/examples/echo/server_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"testing"
77
"time"
88

9-
"nhooyr.io/websocket"
10-
"nhooyr.io/websocket/wsjson"
9+
"github.com/coder/websocket"
10+
"github.com/coder/websocket/wsjson"
1111
)
1212

1313
// Test_echoServer tests the echoServer by sending it 5 different messages

internal/examples/go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
module nhooyr.io/websocket/examples
1+
module github.com/coder/websocket/examples
22

33
go 1.19
44

5-
replace nhooyr.io/websocket => ../..
5+
replace github.com/coder/websocket => ../..
66

77
require (
8+
github.com/coder/websocket v0.0.0-00010101000000-000000000000
89
golang.org/x/time v0.3.0
9-
nhooyr.io/websocket v0.0.0-00010101000000-000000000000
1010
)

internal/test/wstest/echo.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"io"
88
"time"
99

10-
"nhooyr.io/websocket"
11-
"nhooyr.io/websocket/internal/test/xrand"
12-
"nhooyr.io/websocket/internal/xsync"
10+
"github.com/coder/websocket"
11+
"github.com/coder/websocket/internal/test/xrand"
12+
"github.com/coder/websocket/internal/xsync"
1313
)
1414

1515
// EchoLoop echos every msg received from c until an error

internal/test/wstest/pipe.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"net/http"
1111
"net/http/httptest"
1212

13-
"nhooyr.io/websocket"
13+
"github.com/coder/websocket"
1414
)
1515

1616
// Pipe is used to create an in memory connection

0 commit comments

Comments
 (0)