Commit Graph

188 Commits

Author SHA1 Message Date
Gary Burd 404e6b135d Merge pull request #199 from AndrienkoAleksandr/master
Fix up README.md for command example.
2016-12-27 09:27:37 -05:00
Aleksandr Andrienko 0e7877a5a1 Fix up README.md for command example. 2016-12-27 15:04:14 +02:00
Cyrus Katrak 3ab3a8b883 pool flate writers 2016-12-16 15:41:18 -08:00
Gary Burd 0868951cdb Improve WriteMessage fast path
Restructure to avoid messageWriter allocation.
2016-12-07 16:21:58 -08:00
Gary Burd e8f0f8aaa9 Merge pull request #185 from shivamMg/doc-fix
Fix documentation
2016-11-12 06:27:12 -08:00
Shivam Mamgain dc13401989 Fix documentation
Specify correct function name in README
2016-11-12 16:02:12 +05:30
Gary Burd 9fbf129ff2 Add Conn.[Set]CloseHandler 2016-11-02 13:04:59 -07:00
Gary Burd 80a0029a65 Improve write error handling
- Do not fail NextWriter when close of previous writer fails.
- Replace closeSent field with mutex protected writeErr. Set writeErr on
  any error writing to underlying network connection. Check and return
  writeErr before attempting to write to network connection. Check
  writeErr in NextWriter so application can detect failed connection
  before attempting to write.
- Do not close underlying network connection on error.
- Move message writing state and method flushFrame from Conn to
  messageWriter. This makes error code paths (and the code in general)
  easier to understand.
- Add messageWriter field err to latch errors in messageWriter.

Bonus: Improve test coverage.
2016-11-02 09:59:14 -07:00
Gary Burd 343fff4c5c Fix mask alignment
Fix incorrect computation of buffer alignment in maskBytes. With this
change, all word operations on the buffer are aligned on word
boundaries.
2016-11-02 09:16:35 -07:00
Gary Burd 2aff870ef8 Improve command example
- Close connection cleanly on EOF from command.
2016-10-27 21:05:23 -07:00
Gary Burd 6257d10a8b Improve chat example
- Discuss concurrency and message coalescing in the README.
- Add comments to client.go explaining how concurrency requirements are
  met.
- Prevent developers from calling the Client.write method from outside
  of the writePump goroutine by removing the method. The code is now
  inlined in Client.writPump.
2016-10-25 16:48:54 -07:00
Gary Burd 0b847f2fac Update README.md 2016-10-21 12:35:05 -07:00
Gary Burd 2b825c3f82 Merge pull request #169 from garyburd/master
Improve mask performance
2016-10-21 12:12:30 -07:00
Gary Burd 77f110791c Improve mask performance 2016-10-21 11:11:39 -07:00
Gary Burd 460e0a996e Test w/ Go 1.7 on Travis 2016-10-20 16:33:47 -07:00
Gary Burd 5df680c89f Merge pull request #166 from MaximeHeckel/add-cookiejar
add cookie jar to dialer
2016-10-18 19:33:40 -07:00
Maxime Heckel 56d95f2940 add cookie jar to dialer 2016-10-18 09:56:48 -07:00
Gary Burd 8003df83ee Merge pull request #167 from garyburd/master
enable compression
2016-10-17 17:39:55 -07:00
Gary Burd a0ef436d00 compression: add tests, rename option 2016-10-17 17:30:22 -07:00
Gary Burd 17c3c6b6b9 Merge pull request #164 from artyom/master
Update README to reflect change of Go sub-repo websocket feature
2016-10-17 08:03:37 -07:00
Artyom Pervukhin 99ffb988ce Update README to reflect change of Go sub-repo websocket feature
Closes #164
2016-10-17 11:17:13 +03:00
Cyrus Katrak c09b72d2ee per message compression; only no context modes 2016-10-14 12:08:39 -07:00
Gary Burd 2d1e4548da Simplify dial TLS test
There's no need to fake the connection to example.com because 127.0.0.1
is a host in the net/http/httptest certificate.
2016-09-12 08:30:41 -07:00
Gary Burd a69d25be2f Merge pull request #152 from sambooo/patch-1
Fix typos in chat example
2016-08-02 06:32:03 -07:00
Sam Broughton 295028b997 Fix typos in chat example 2016-08-02 07:24:52 +01:00
Gary Burd 5e2e56d5df Improve chat example
- Remove jQuery.
- Rename Conn to Client to avoid confusion with underlying ws
  connection.
- Remove global variables.
2016-07-18 16:08:34 -07:00
Gary Burd a836c37014 Merge pull request #150 from RHavar/patch-1
Update hub.go
2016-07-10 21:44:50 -07:00
Ryan Havar b5afd49817 Update hub.go 2016-07-10 23:15:05 -05:00
Gary Burd 54f9decdbf Add description to the chat example readme 2016-07-01 11:57:38 -07:00
Gary Burd a87eae1d6f Add hooks to support RFC 7692 (per-message compression extension)
Add newCompressionWriter and newDecompressionReader fields to Conn. When
not nil, these functions are used to create a compression/decompression
wrapper around an underlying message writer/reader.

Add code to set and check for RSV1 frame header bit.

Add functions compressNoContextTakeover and decompressNoContextTakeover
for creating no context takeover wrappers around an underlying message
writer/reader.

Work remaining:

- Add fields to Dialer and Upgrader for specifying compression options.
- Add compression negotiation to Dialer and Upgrader.
- Add function to enable/disable write compression:

    // EnableWriteCompression enables and disables write compression of
    // subsequent text and binary messages. This function is a noop if
    // compression was not negotiated with the peer.
    func (c *Conn) EnableWriteCompression(enable bool) {
            c.enableWriteCompression = enable
    }
2016-06-29 17:03:55 -07:00
Gary Burd b5389d0dc2 Implement RFC 6455, section 4.4 2016-06-29 13:56:55 -07:00
Gary Burd a68708917c Coalesce outbound messages in chat example 2016-06-06 16:20:22 -07:00
Gary Burd 3ddc984058 Merge pull request #136 from reeze/add-handler-getter
Add Ping/Pong handler Getter functions
2016-05-31 22:17:19 -07:00
Reeze Xia c9ce64ea05 Add Ping/Pong handler getter methods 2016-06-01 11:26:10 +08:00
Gary Burd 8b29b78138 Add Sec-WebSocket-Extensions header parser
Also, improve token list header parser.
2016-05-31 09:32:45 -07:00
Gary Burd be01041b66 Reduce memory allocations in NextReader, NextWriter
Redo 8b209f6317 with support for old
versions of Go.
2016-05-31 05:44:45 -07:00
Gary Burd 50d660d6ac Revert "Reduce memory allocations in NextReader, NextWriter"
This reverts commit 8b209f6317.
2016-05-30 01:53:33 -07:00
Gary Burd afffb15196 Merge branch 'varnames' 2016-05-26 21:01:19 -07:00
Gary Burd 24cddddcc0 Use single character receiver names in chat example 2016-05-26 21:00:24 -07:00
Gary Burd 8b209f6317 Reduce memory allocations in NextReader, NextWriter 2016-05-26 14:07:24 -07:00
Gary Burd 2301bcbf5c Cleanup js in chat example 2016-05-26 10:19:40 -07:00
Jean de Klerk be95f72b73 Meaningful names for connection, message 2016-05-18 08:57:16 -06:00
Jean de Klerk a6108176e8 Meaningful names for hub 2016-05-18 08:56:16 -06:00
Gary Burd 1f512fc3f0 Handle invalid close frames
Send protocol error if close code or payload are invalid.

Fixes Autobahn tests 7.5.1, 7.9.*.
2016-04-28 09:34:18 -07:00
Gary Burd a724ba4528 Test truncated frames at all positions 2016-04-25 08:42:53 -07:00
Tarmigan Casebolt ae46df13e9 Fix Read() to return errUnexpectedEOF when EOF is received before all bytes in the frame have been read 2016-04-24 22:30:05 -07:00
Gary Burd 703e8da19b Drop Go 1.3 from supported configurations
The code does not build on 1.3 because tls.Config does not contain the
GetCertificate field. This can be worked around using build constraints,
but it does not seem worth the trouble.
2016-04-23 15:56:33 -07:00
Gary Burd 5a00fb2e99 Do not shallow copy crypto/tls.Config
The Config contains a sync.Once that should not be copied.
2016-04-23 15:46:58 -07:00
Gary Burd 3d02343cd3 .travis.yml go vet fix. 2016-04-22 22:25:05 -07:00
Gary Burd 6b3d49710b Fix filewatch example
Use last modified time when the time is parsed without error. This prevents an
extra file read at start of watch for a connection.

Fixes #125.
2016-04-21 17:30:17 -07:00