Skip to content
This repository was archived by the owner on Apr 26, 2020. It is now read-only.

Commit 4af9ae8

Browse files
HeadwindFlyHeadwindFly
authored andcommitted
Initial commit
1 parent 7feb9c7 commit 4af9ae8

File tree

19 files changed

+2714
-13
lines changed

19 files changed

+2714
-13
lines changed

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
13+
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
19+
20+
_testmain.go
21+
22+
*.exe
23+
24+
.idea/
25+
*.iml

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: go
2+
sudo: false
3+
4+
matrix:
5+
include:
6+
- go: 1.4
7+
- go: 1.5
8+
- go: 1.6
9+
- go: tip
10+
allow_failures:
11+
- go: tip
12+
13+
script:
14+
- go get -t -v ./...
15+
- diff -u <(echo -n) <(gofmt -d .)
16+
- go vet $(go list ./... | grep -v /vendor/)
17+
- go test -v -race ./...

AUTHORS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This is the official list of Gorilla WebSocket authors for copyright
2+
# purposes.
3+
#
4+
# Please keep the list sorted.
5+
6+
Gary Burd <gary@beagledreams.com>
7+
Joachim Bauch <mail@joachim-bauch.de>
8+

LICENSE

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
Copyright (c) 2016, CleverGo
2-
All rights reserved.
1+
Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved.
32

43
Redistribution and use in source and binary forms, with or without
54
modification, are permitted provided that the following conditions are met:
65

7-
* Redistributions of source code must retain the above copyright notice, this
6+
Redistributions of source code must retain the above copyright notice, this
87
list of conditions and the following disclaimer.
98

10-
* Redistributions in binary form must reproduce the above copyright notice,
9+
Redistributions in binary form must reproduce the above copyright notice,
1110
this list of conditions and the following disclaimer in the documentation
1211
and/or other materials provided with the distribution.
1312

14-
* Neither the name of websocket nor the names of its
15-
contributors may be used to endorse or promote products derived from
16-
this software without specific prior written permission.
17-
18-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2116
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
2217
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2318
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR

README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,64 @@
1-
# websocket
2-
WebSocket package for golang fasthttp.
1+
# Gorilla WebSocket
2+
3+
Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
4+
[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
5+
6+
*This fork adds support for the Go HTTP package
7+
[fasthttp](https://github.com/valyala/fasthttp), which is a high performance,
8+
byte slice oriented alternative to `net/http`.*
9+
10+
### Note that
11+
The original repo is [Gorilla WebSocket](https://github.com/gorilla/websocket), and this project is fork from [leavengood/websocket](https://github.com/leavengood/websocket).
12+
I am not the author, I just removed the supported for `net/http`, improved the **Upgrader** and provided some examples for fasthttp.
13+
14+
### Documentation
15+
* [Chat example](examples/chat)
16+
17+
### Status
18+
19+
The Gorilla WebSocket package provides a complete and tested implementation of
20+
the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The
21+
package API is stable.
22+
23+
### Installation
24+
25+
go get github.com/gorilla/websocket
26+
27+
### Protocol Compliance
28+
29+
The Gorilla WebSocket package passes the server tests in the [Autobahn Test
30+
Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn
31+
subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn).
32+
33+
### Gorilla WebSocket compared with other packages
34+
35+
<table>
36+
<tr>
37+
<th></th>
38+
<th><a href="http://godoc.org/github.com/gorilla/websocket">github.com/gorilla</a></th>
39+
<th><a href="http://godoc.org/golang.org/x/net/websocket">golang.org/x/net</a></th>
40+
</tr>
41+
<tr>
42+
<tr><td colspan="3"><a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> Features</td></tr>
43+
<tr><td>Passes <a href="http://autobahn.ws/testsuite/">Autobahn Test Suite</a></td><td><a href="https://github.com/gorilla/websocket/tree/master/examples/autobahn">Yes</a></td><td>No</td></tr>
44+
<tr><td>Receive <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmented</a> message<td>Yes</td><td><a href="https://code.google.com/p/go/issues/detail?id=7632">No</a>, see note 1</td></tr>
45+
<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">close</a> message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=4588">No</a></td></tr>
46+
<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.2">pings</a> and receive <a href="https://tools.ietf.org/html/rfc6455#section-5.5.3">pongs</a></td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td>No</td></tr>
47+
<tr><td>Get the <a href="https://tools.ietf.org/html/rfc6455#section-5.6">type</a> of a received data message</td><td>Yes</td><td>Yes, see note 2</td></tr>
48+
<tr><td colspan="3">Other Features</tr></td>
49+
<tr><td>Limit size of received message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.SetReadLimit">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=5082">No</a></td></tr>
50+
<tr><td>Read message using io.Reader</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextReader">Yes</a></td><td>No, see note 3</td></tr>
51+
<tr><td>Write message using io.WriteCloser</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextWriter">Yes</a></td><td>No, see note 3</td></tr>
52+
</table>
53+
54+
Notes:
55+
56+
1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html).
57+
2. The application can get the type of a received data message by implementing
58+
a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal)
59+
function.
60+
3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries.
61+
Read returns when the input buffer is full or a frame boundary is
62+
encountered. Each call to Write sends a single frame message. The Gorilla
63+
io.Reader and io.WriteCloser operate on a single WebSocket message.
64+

0 commit comments

Comments
 (0)