Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement complete close handshake #160

Merged
merged 5 commits into from
Oct 9, 2019
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ on: [push]
jobs:
fmt:
runs-on: ubuntu-latest
container: nhooyr/websocket-ci@sha256:f8b6e53a9fd256bcf6c90029276385b9ec730b76a0d7ccf3ff19084bce210c50
container: nhooyr/websocket-ci@sha256:13f9b8cc2f901e98c253595c4070254ece08543f6e100b4fa6682f87de4388eb
steps:
- uses: actions/checkout@v1
- run: yarn --frozen-lockfile && yarn fmt
lint:
runs-on: ubuntu-latest
container: nhooyr/websocket-ci@sha256:f8b6e53a9fd256bcf6c90029276385b9ec730b76a0d7ccf3ff19084bce210c50
container: nhooyr/websocket-ci@sha256:13f9b8cc2f901e98c253595c4070254ece08543f6e100b4fa6682f87de4388eb
steps:
- uses: actions/checkout@v1
- run: yarn --frozen-lockfile && yarn lint
test:
runs-on: ubuntu-latest
container: nhooyr/websocket-ci@sha256:f8b6e53a9fd256bcf6c90029276385b9ec730b76a0d7ccf3ff19084bce210c50
container: nhooyr/websocket-ci@sha256:13f9b8cc2f901e98c253595c4070254ece08543f6e100b4fa6682f87de4388eb
steps:
- uses: actions/checkout@v1
- run: yarn --frozen-lockfile && yarn test
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ go get nhooyr.io/websocket
- Highly optimized by default
- Concurrent writes out of the box
- [Complete Wasm](https://godoc.org/nhooyr.io/websocket#hdr-Wasm) support
- [Close handshake](https://godoc.org/nhooyr.io/websocket#Conn.Close)

## Roadmap

Expand Down Expand Up @@ -128,7 +129,9 @@ gorilla/websocket writes its handshakes to the underlying net.Conn.
Thus it has to reinvent hooks for TLS and proxies and prevents support of HTTP/2.

Some more advantages of nhooyr.io/websocket are that it supports concurrent writes and
makes it very easy to close the connection with a status code and reason.
makes it very easy to close the connection with a status code and reason. In fact,
nhooyr.io/websocket even implements the complete WebSocket close handshake for you whereas
with gorilla/websocket you have to perform it manually. See [gorilla/websocket#448](https://github.com/gorilla/websocket/issues/448).

The ping API is also nicer. gorilla/websocket requires registering a pong handler on the Conn
which results in awkward control flow. With nhooyr.io/websocket you use the Ping method on the Conn
Expand Down
2 changes: 1 addition & 1 deletion ci/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (require.main === module) {
}

export async function test(ctx: Promise<unknown>) {
const args = ["-parallel=1024", "-coverprofile=ci/out/coverage.prof", "-coverpkg=./..."]
const args = ["-parallel=32", "-coverprofile=ci/out/coverage.prof", "-coverpkg=./..."]

if (process.env.CI) {
args.push("-race")
Expand Down
Loading