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
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
# HACK(mafredri): The exampels and thirdparty library require Go 1.24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here and on line 33

Suggested change
# HACK(mafredri): The exampels and thirdparty library require Go 1.24
# HACK(mafredri): The examples and thirdparty library require Go 1.24

# due to `golang.org/x/crypto` import, so lint tools must be built by
# the highest version of Go used.
go-version-file: ./internal/thirdparty/go.mod
- run: make fmt

lint:
Expand All @@ -27,7 +30,10 @@ jobs:
- run: go version
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
# HACK(mafredri): The exampels and thirdparty library require Go 1.24
# due to `golang.org/x/crypto` import, so lint tools must be built by
# the highest version of Go used.
go-version-file: ./internal/thirdparty/go.mod
- run: make lint

test:
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,3 @@ jobs:
with:
name: coverage.html
path: ./ci/out/coverage.html
bench-dev:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is this just maintenance or related to this PR? If the first one, perhaps split it... just in case we have to revert this one :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintenance, I'll break the unrelated stuff into a separate PR 👍🏻

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: dev
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: AUTOBAHN=1 make bench
test-dev:
runs-on: ubuntu-latest
steps:
- name: Disable AppArmor
if: runner.os == 'Linux'
run: |
# Disable AppArmor for Ubuntu 23.10+.
# https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- uses: actions/checkout@v4
with:
ref: dev
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: AUTOBAHN=1 make test
- uses: actions/upload-artifact@v4
with:
name: coverage-dev.html
path: ./ci/out/coverage.html
6 changes: 1 addition & 5 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ jobs:
go-version-file: ./go.mod
- name: Generate coverage and badge
run: |
make test
mkdir -p ./ci/out/static
cp ./ci/out/coverage.html ./ci/out/static/coverage.html
percent=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')
wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${percent}%25-success"
make static
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ lint:
test:
./ci/test.sh

.PHONY: static
static:
make test
./ci/static.sh

.PHONY: bench
bench:
./ci/bench.sh
./ci/bench.sh
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ go get github.com/coder/websocket
- [RFC 7692](https://tools.ietf.org/html/rfc7692) permessage-deflate compression
- [CloseRead](https://pkg.go.dev/github.com/coder/websocket#Conn.CloseRead) helper for write only connections
- Compile to [Wasm](https://pkg.go.dev/github.com/coder/websocket#hdr-Wasm)
- Experimental support for HTTP/2 extended CONNECT (RFC 8441)
- Requires opt-in via the [AcceptOptions](https://pkg.go.dev/github.com/coder/websocket#AcceptOptions) and [DialOptions](https://pkg.go.dev/github.com/coder/websocket#DialOptions) Protocol option
- Clients must provide a `http2.Transport`
- Servers must be started with `GODEBUG=http2xconnect=1`, see https://github.com/golang/go/issues/53208
- See the [http2 example](./internal/examples/http2)

## Roadmap

Expand All @@ -43,7 +48,7 @@ See GitHub issues for minor issues but the major future enhancements are:
- [ ] 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)
- [x] HTTP/2 extended CONNECT (RFC 8441) [#4](https://github.com/coder/websocket/issues/4)
- [ ] The holy grail [#402](https://github.com/nhooyr/websocket/issues/402)

## Examples
Expand All @@ -53,6 +58,8 @@ For a production quality example that demonstrates the complete API, see the

For a full stack example, see the [chat example](./internal/examples/chat).

For a HTTP/2 WebSocket example, see the [http2 example](./internal/examples/http2).

### Server

```go
Expand Down
Loading