https://github.com/icarephone/websocket
Gorilla WebSocket implementation for fasthttp.
https://github.com/icarephone/websocket
go websocket
Last synced: 5 months ago
JSON representation
Gorilla WebSocket implementation for fasthttp.
- Host: GitHub
- URL: https://github.com/icarephone/websocket
- Owner: icarephone
- License: bsd-2-clause
- Created: 2020-06-19T06:46:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-16T05:56:41.000Z (over 3 years ago)
- Last Synced: 2024-06-20T19:19:14.869Z (about 2 years ago)
- Topics: go, websocket
- Language: Go
- Homepage:
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
- Authors: AUTHORS
Awesome Lists containing this project
README
# Fasthttp Gorilla WebSocket
[](https://travis-ci.org/fasthttp/websocket)
[](https://goreportcard.com/report/github.com/icarephone/websocket)
[](https://pkg.go.dev/github.com/icarephone/websocket)
[](https://github.com/icarephone/websocket/releases)
[Gorilla WebSocket](https://github.com/gorilla/websocket) is a [Go](http://golang.org/) implementation of the
[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
This fork adds [fasthttp](https://github.com/valyala/fasthttp) support to the latest version of [gorilla/websocket](https://github.com/gorilla/websocket).
### Documentation
* [API Reference](https://pkg.go.dev/github.com/icarephone/websocket?tab=doc)
* [Chat example](_examples/chat)
* [Command example](_examples/command)
* [Client and server example](_examples/echo)
* [File watch example](_examples/filewatch)
### Status
The Gorilla WebSocket package provides a complete and tested implementation of
the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The
package API is stable.
### Installation
```
go get github.com/icarephone/websocket
```
But beware that this will fetch the **latest commit of the master branch** which is never purposely broken, but usually not considered stable anyway.
#### Dep
If you're using [dep](https://github.com/golang/dep), just use `dep ensure` to add
a specific version of fasthttp/websocket including all its transitive dependencies to
your project:
```
dep ensure -add github.com/icarephone/websocket@v1.4.0
```
**IMPORTANT:** [dep](https://github.com/golang/dep) is only supported until version v1.4.0. In future versions will use Go modules.
### Protocol Compliance
The Gorilla WebSocket package passes the server tests in the [Autobahn Test
Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn
subdirectory](_examples/autobahn).
### Gorilla WebSocket compared with other packages
github.com/fasthttp
golang.org/x/net
RFC 6455 Features
Passes Autobahn Test SuiteYesNo
Receive fragmented messageYesNo, see note 1
Send close messageYesNo
Send pings and receive pongsYesNo
Get the type of a received data messageYesYes, see note 2
Other Features
Compression ExtensionsExperimentalNo
Read message using io.ReaderYesNo, see note 3
Write message using io.WriteCloserYesNo, see note 3
Notes:
1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html).
2. The application can get the type of a received data message by implementing
a [codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal)
function.
3. The [go/net](https://golang.org/pkg/net/) `io.Reader` and `io.Writer` operate across WebSocket frame boundaries.
Read returns when the input buffer is full or a frame boundary is
encountered. Each call to Write sends a single frame message. The Gorilla
`io.Reader` and `io.WriteCloser` operate on a single WebSocket message.