Commit Graph

267 Commits

Author SHA1 Message Date
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
Gary Burd adf16b3178 Add safe maskBytes
Fixes #200.
2016-12-31 20:13:41 -08:00
Gary Burd 5ddbd28fbd Merge branch 'compress' 2016-12-27 17:08:04 -05:00
Gary Burd 6c51b25bc8 Compression improvements
- Remove unnecessary error return from compressNoContextTakeover.
- Simplify use of sync.Pool.
- Fix formatting in compression documentation.
2016-12-27 17:05:16 -05:00
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 2db2f66488 pool flate readers 2016-12-19 07:28:05 -08: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