• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.circleci/H19-Mar-2020-

.github/H19-Mar-2020-

examples/H19-Mar-2020-

.gitignoreH A D19-Mar-2020266

AUTHORSH A D19-Mar-2020234

LICENSEH A D19-Mar-20201.3 KiB

README.mdH A D19-Mar-20203.9 KiB

client.goH A D19-Mar-202011.3 KiB

client_clone.goH A D19-Mar-2020348

client_clone_legacy.goH A D19-Mar-20201.3 KiB

client_server_test.goH A D19-Mar-202020.7 KiB

client_test.goH A D19-Mar-20201 KiB

compression.goH A D19-Mar-20203.1 KiB

compression_test.goH A D19-Mar-20201.8 KiB

conn.goH A D19-Mar-202031.6 KiB

conn_broadcast_test.goH A D19-Mar-20203 KiB

conn_test.goH A D19-Mar-202018.1 KiB

conn_write.goH A D19-Mar-2020341

conn_write_legacy.goH A D19-Mar-2020398

doc.goH A D19-Mar-20209.4 KiB

example_test.goH A D19-Mar-20201.3 KiB

go.modH A D19-Mar-202045

go.sumH A D19-Mar-20200

join.goH A D19-Mar-2020913

join_test.goH A D19-Mar-20201.1 KiB

json.goH A D19-Mar-20201.5 KiB

json_test.goH A D19-Mar-20202 KiB

mask.goH A D19-Mar-20201.1 KiB

mask_safe.goH A D19-Mar-2020339

mask_test.goH A D19-Mar-20201.6 KiB

prepared.goH A D19-Mar-20202.9 KiB

prepared_test.goH A D19-Mar-20201.9 KiB

proxy.goH A D19-Mar-20201.9 KiB

server.goH A D19-Mar-202011.7 KiB

server_test.goH A D19-Mar-20203.2 KiB

trace.goH A D19-Mar-2020396

trace_17.goH A D19-Mar-2020221

util.goH A D19-Mar-20205.4 KiB

util_test.goH A D19-Mar-20202.9 KiB

x_net_proxy.goH A D19-Mar-202012.6 KiB

README.md

1# Gorilla WebSocket
2
3[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket)
4[![CircleCI](https://circleci.com/gh/gorilla/websocket.svg?style=svg)](https://circleci.com/gh/gorilla/websocket)
5
6Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
7[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
8
9### Documentation
10
11* [API Reference](https://pkg.go.dev/github.com/gorilla/websocket?tab=doc)
12* [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat)
13* [Command example](https://github.com/gorilla/websocket/tree/master/examples/command)
14* [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo)
15* [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch)
16
17### Status
18
19The Gorilla WebSocket package provides a complete and tested implementation of
20the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The
21package API is stable.
22
23### Installation
24
25    go get github.com/gorilla/websocket
26
27### Protocol Compliance
28
29The Gorilla WebSocket package passes the server tests in the [Autobahn Test
30Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn
31subdirectory](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="https://github.com/crossbario/autobahn-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><a href="https://tools.ietf.org/html/rfc7692">Compression Extensions</a></td><td>Experimental</td><td>No</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
54Notes:
55
561. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html).
572. 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.
603. 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
65