Commit Graph

292 Commits

Author SHA1 Message Date
Gary Burd 292fd08b25
Replace "frame" with "message" in documentation
The documentation sometimes used the term "frame" when referring to
single frame control messages.  Use the term "message" for consistency
in the documentation and to hide a detail that most application
programmers do not need to know about.
2018-01-10 06:15:25 -08:00
Gary Burd 58729a2165
Don't log 1006 error in chat example
This error is expected (Safari closes connections without sending a close
frame).

Fixes #323
2018-01-09 12:15:58 -08:00
Gary Burd d965e9adc6
Handle no status in FormatCloseMessage
Return empty message for CloseNoStatusReceived. This status indicates
that the message is empty, so make it so. Because it's illegal to send
CloseNoStatusReceived, this change should not break a correct
application.
2017-12-28 07:29:59 -08:00
Jordan Pittier cdedf21e58 examples/chat/client.go: avoid allocating []byte{} for PingMessage (#312)
It's useless and only gives more work to the GC.
2017-12-09 19:53:53 -08:00
Gary Burd c55883f973
Add parseExtensions test case (#310) 2017-12-05 11:45:40 -08:00
Gary Burd b89020ee79
Add SOCKS5 support
- Bundle the golang.org/x/net/proxy package to x_net_proxy.go. The
package contains a SOCKS5 proxy. The package is bundled to avoid adding
a dependency from the weboscket package to golang.org/x/net.
- Restructure the existing HTTP proxy code so the code can be used as a
dialer with the proxy package.
- Modify Dialer.Dial to use proxy.FromURL.
- Improve tests (avoid modifying package-level data, use timeouts in
tests, use correct proxy URLs in tests).

Fixes #297.
2017-11-30 17:43:01 -08:00
Gary Burd 8c6cfd493d
Improve bad handshake error text
Change the error text for bad handshake errors from

    websocket: not a websocket handshake:

to:

    websocket: the client is not using the websocket protocol:

The new text should be more helpful to developers who do not know or
understand the details of the protocol.

Test for bad handshake before other request errors.
2017-11-30 16:45:44 -08:00
fising 2b58522131 update README.md 2017-11-29 07:20:15 -08:00
David Dollar b648f206c2 Use ASCII case folding in same origin test 2017-11-27 16:10:45 -08:00
Gary Burd 23059f2957 Update with gofmt on tip
The changes are compatible with older versions of gofmt.
2017-11-23 00:11:29 -08:00
Gary Burd 447c2df769 Compare request header tokens with ASCII case folding
Compare request header tokens with ASCII case folding per the WebSocket
RFC.
2017-11-22 23:15:27 -08:00
Gary Burd aa5ed01c91 Improve control message handling documentation
Closes #299
2017-11-19 13:55:18 -08:00
Sebastian Waisbrot 7ca4275b84 More consistent error handling in doc
I noticed the example is actually wrong as the same block both calls `return` with no parameter and `return err`. I think it would be better to allow the code to be used directly. I added calls to log.Println as it was used on the other example as it might be more useful for newcomers to see error messages.
2017-11-12 07:44:06 -08:00
Gary Burd 3da6ca0cb6 Simplify and fix spelling errors in test files
Simplify using gofmt -s.
2017-11-02 08:08:30 -07:00
Jérôme Bernard 71fa72d484 Replace parseURL() with net/url.Parse() (#290) 2017-10-12 19:08:58 -07:00
Gary Burd f918560c4c Improve NextWriter documentation 2017-10-10 09:16:43 -07:00
xPushkin c908dc801c Typo fix
Just a small typo fix.
2017-10-07 13:56:17 -07:00
Gary Burd 4201258b82 Merge pull request #286 from alaingilbert/patch-1
Add missing html tag in example/echo
2017-09-26 16:33:35 -07:00
Alain Gilbert 5755884efa
Add missing html tag in example/echo 2017-09-26 16:13:09 -07:00
Gary Burd 6f34763140 Add Go 1.9 to Travis config 2017-09-13 22:11:54 -07:00
Gary Burd a69d9f6de4 Merge branch 'updoc' 2017-07-18 13:23:41 -07:00
Gary Burd 92f772e4b3 Misc cleanup
- Fix lint warnings.
- Use standard comment format to mark deprecated identifiers.
- Remove redundant paragraph from doc.
2017-07-18 13:21:30 -07:00
fuzzybear3965 f4f69d2d8d implementing (some of) @garyburd's suggestions 2017-07-10 10:21:27 -04:00
Gary Burd 462d5c5828 Merge pull request #261 from kybin/master
doc: use ":=" when check error for conn.WriteMessage
2017-07-08 03:26:55 -04:00
fuzzybear3965 1d375d5a0d distinguish Upgrader.Upgrade from Upgrade 2017-07-07 14:47:14 -04:00
kim yongbin 7a8dacf0a7 doc: use ":=" when check error for conn.WriteMessage 2017-07-02 19:51:28 +09:00
Gary Burd ea4d1f681b Reduce memory used in chat example 2017-06-20 12:01:03 -07:00
Gary Burd a91eba7f97 Merge pull request #230 from FZambia/fix_client_compression
Enable client compression based on response header
2017-03-19 13:27:27 -04:00
Alexander Emelin 8dc1cf94c1 enable client compression based on response header 2017-03-19 11:36:38 +03:00
Gary Burd b258b4fadb Use bufio.Writer returned from hijack in upgrade
Reuse the buffer backing the bufio.Writer returned from hijack if that
buffer is large enough to be generally useful and
Upgrader.WriteBufferSize == 0.

Update the logic for reusing bufio.Reader returned from hijack to match
the logic for bufio.Reader:  The buffer backing the reader must be
sufficiently large to be generally useful and Upgrader.ReadBufferSize ==
0.

Improve the documentation for ReadBufferSize and WriterBufferSize in
Dialer and Upgrader.
2017-03-02 14:46:13 -08:00
Gary Burd 4873052237 Fix formatting. 2017-03-01 09:42:05 -08:00
Gary Burd 286b5c9371 Use bufio.Reader returned from hijack in upgrade
Use the bufio.Reader returned from hijack if the reader's buffer size is
equal to the buffer size specified in Upgrader.ReadBufferSize.
2017-03-01 09:36:54 -08:00
William Wennerström 3f3e394da2 Update cloneTLSConfig to use Go 1.8 Config.Clone method 2017-02-18 08:27:10 -08:00
Gary Burd 9acaa683f0 Add Go 1.8 to Travis config 2017-02-16 13:52:12 -08:00
Gary Burd 5ade364dff Improve examples
- Remove jQuery dependency in command example.
- Fix auto scroll on new content in chat and command example.
- Update chat and command example to use a static HTML file.
2017-02-15 17:01:07 -08:00
Gary Burd 804cb600d0 Prepared Messages (#211) 2017-02-14 09:41:18 -08:00
Shrumit Mehta 9bc973af06 Change text/template to html/template in the examples
Change text/template to html/template in examples
2017-02-13 10:21:12 -08:00
Gary Burd c36f2fe5c3 Merge pull request #210 from nobuf/nobuf/update-doc-about-compression
Add code snippet for EnableCompression in doc.go
2017-01-26 11:14:27 -08:00
Nobu Funaki 1025138dad Add code snippet for EnableCompression in doc.go, change EnableWriteCompression()'s parameter to false since enableWriteCompression is true by default. 2017-01-26 10:48:11 -08:00
Gary Burd 4e4c8d08b4 Merge pull request #208 from FZambia/flate_write_pool_fix
fix flate write pool size to work with best compression
2017-01-24 15:37:53 -08:00
Alexander Emelin ac61189060 remove test as HuffmanOnly compression level not defined in Go < 1.7 2017-01-25 02:34:04 +03:00
Alexander Emelin eb457539f7 fix flate write pool size to work with best compression 2017-01-25 02:15:04 +03:00
Gary Burd 0674c7c796 Improve upgrade error messages
Upgrade typically fails because the request is not a handshake, not
because the handshake is malformed. To help developers diagnose the
common case, state explicitly that the request is not a handshake in
error messages.

To help diagnose malformed requests, capitalize and 'quote' header names
in error messages.
2017-01-23 10:55:51 -08:00
Gary Burd 2257eda00b Fix compile error on Go < 1.6 2017-01-19 11:27:08 -08:00
Gary Burd 522f286a67 Fix to compile on Go < 1.6 2017-01-19 11:23:28 -08:00
Gary Burd b0dc45572b Change default and add API for compression level
Change the default compression level to 1. This level is faster and uses
less memory.

Add Conn.SetCompressionLevel API to allow applications to tune
compression on a per message basis.
2017-01-19 11:00:23 -08:00
Gary Burd bb547c6c5c Improve SetXHandler documentation 2017-01-15 13:09:21 -08:00
Gary Burd 561ac01ecf Merge pull request #205 from FZambia/compression_benchmarks
benchmarks for write with compression enabled/disabled
2017-01-13 20:07:17 -08:00
Alexandr Emelin 34e053563d benchmarks for write with compression enabled/disabled 2017-01-13 12:06:51 +03:00
Gary Burd 17634340a8 Update compression documentation
Add "EXPERIMENTAL" to the compress section header.  This change is intended to draw more attention to the status of the feature as stated in the first sentence of the section.  This is not a change in the status.
2017-01-11 11:29:28 -08:00