A fast, well-tested and widely used WebSocket implementation for Go.
Go to file
Henrik Hautakoski 6f5d2139f4
conn.go: default close handler should not return ErrCloseSent. (#865)
<!--
For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for
further details.

     For a timely review/response, please avoid force-pushing additional
     commits if your PR already received reviews or comments.

     Before submitting a Pull Request, please ensure that you have:
- 📖 Read the Contributing guide:
https://github.com/gorilla/.github/blob/main/CONTRIBUTING.md
- 📖 Read the Code of Conduct:
https://github.com/gorilla/.github/blob/main/CODE_OF_CONDUCT.md

     - Provide tests for your changes.
     - Use descriptive commit messages.
	 - Comment your code where appropriate.
	 - Squash your commits
     - Update any related documentation.

     - Add gorilla/pull-request-reviewers as a Reviewer
-->

## What type of PR is this? (check all applicable)

- [ ] Refactor
- [ ] Feature
- [x] Bug Fix
- [ ] Optimization
- [ ] Documentation Update
- [ ] Go Version Update
- [ ] Dependency Update

## Description

Noticed a change in default close handler from 1.5.0 to 1.5.1

1.5.1 Now returns the error from `WriteControl` with `CloseMessage`
type. However this results in ErrCloseSent returned if the connection
initiated the close handshake. This is normally correct as the
connection should not be able to write after a close handshake is
initiated, except when calling the close handler. in that case nil
should be returned so that `advanceFrame()` can return the actual close
message.

## Related Tickets & Documents

## Added/updated tests?

- [x] Yes
- [ ] No, and this is why: _please replace this line with details on why
tests
      have not been included_
- [ ] I need help with writing tests

## Run verifications and test

- [ ] `make verify` is passing (fails with `GO-2023-2186 Incorrect
detection of reserved device names on Windows in path/filepath` that is
unrelated to this change)
- [x] `make test` is passing

Co-authored-by: Corey Daley <cdaley@redhat.com>
2023-11-12 19:54:23 -05:00
.github/workflows update GitHub workflows (#857) 2023-10-18 17:57:41 +05:30
examples Update README.md, replace master to main (#862) 2023-11-08 13:57:41 -05:00
vendor update golang.org/x/net (#856) 2023-10-17 19:57:41 -04:00
.editorconfig Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
.gitignore Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
.golangci.yml Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
LICENSE Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
Makefile Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
README.md Update README.md, replace master to main (#862) 2023-11-08 13:57:41 -05:00
client.go Use status code constant (#864) 2023-11-09 06:42:05 -05:00
client_server_test.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
client_test.go Replace parseURL() with net/url.Parse() (#290) 2017-10-12 19:08:58 -07:00
compression.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
compression_test.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
conn.go conn.go: default close handler should not return ErrCloseSent. (#865) 2023-11-12 19:54:23 -05:00
conn_broadcast_test.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
conn_test.go conn.go: default close handler should not return ErrCloseSent. (#865) 2023-11-12 19:54:23 -05:00
doc.go docs: Fix typo. (#568) 2020-03-19 10:45:00 -07:00
example_test.go Fix a couple of small typo's (#567) 2020-03-19 06:49:51 -07:00
go.mod update GitHub workflows (#857) 2023-10-18 17:57:41 +05:30
go.sum update golang.org/x/net (#856) 2023-10-17 19:57:41 -04:00
join.go Add JoinMessages 2019-02-04 16:42:47 -08:00
join_test.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
json.go Misc cleanup 2017-07-18 13:21:30 -07:00
json_test.go Add write buffer pooling 2018-08-22 14:11:59 -07:00
mask.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
mask_safe.go Update source to match output from gofmt 1.17 2021-12-17 22:48:51 -05:00
mask_test.go miscellaneous cleanup 2018-08-24 14:03:26 -07:00
prepared.go Use empty struct to protect writing (#566) 2020-03-19 06:52:00 -07:00
prepared_test.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
proxy.go Use status code constant (#864) 2023-11-09 06:42:05 -05:00
server.go Fixes subprotocol selection (aling with rfc6455) (#823) 2023-11-07 08:35:30 -05:00
server_test.go Fixes subprotocol selection (aling with rfc6455) (#823) 2023-11-07 08:35:30 -05:00
tls_handshake.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
util.go Update go version & add verification/testing tools (#840) 2023-08-27 01:31:45 +05:30
util_test.go Add check for Sec-WebSocket-Key header (#752) 2022-02-15 17:15:20 -08:00

README.md

gorilla/websocket

testing codecov godoc sourcegraph

Gorilla WebSocket is a Go implementation of the WebSocket protocol.

Gorilla Logo

Documentation

Status

The Gorilla WebSocket package provides a complete and tested implementation of the WebSocket protocol. The package API is stable.

Installation

go get github.com/gorilla/websocket

Protocol Compliance

The Gorilla WebSocket package passes the server tests in the Autobahn Test Suite using the application in the examples/autobahn subdirectory.