Commit Graph

31 Commits

Author SHA1 Message Date
Gary Burd 91f589db02
Improve check origin documentation
Remove the example code to disable origin checks from the documentation.
I am concerned that developers are copying the code without
understanding the security implications of the code. Most applications
should not use this code.

Change the bad origin error message to mention Upgrader.CheckOrigin

Mention cross-site request forgery in the Upgrader.CheckOrigin doc.
2018-01-25 10:51:21 -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 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
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
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 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 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 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 a0ef436d00 compression: add tests, rename option 2016-10-17 17:30:22 -07:00
Cyrus Katrak c09b72d2ee per message compression; only no context modes 2016-10-14 12:08:39 -07:00
Gary Burd e2e3d8414d Document that default ping handler can block 2016-03-13 12:14:46 -07:00
Gary Burd 0e2713e645 Address common gotchas with package
Update documentation to explicitly state that applications must break out of a
read loop on error.

Detect application read loops spinning on a failed connection and panic.

Detect concurrent writes and panic. The detection is best-effort.

Update documentation to state that connections respond to close frames.
2016-02-16 15:03:54 -08:00
Valentin Hăloiu 6b3bf61ce8 Fix documentation typos 2016-02-11 02:22:44 +02:00
Gary Burd 423912737d Improve documentation 2015-10-19 15:05:01 -07:00
Craig Jellick 8ba5eaa6df Fix typo 2015-05-29 16:26:01 -07:00
Gary Burd 02eec998da Improve documentation. 2014-10-31 14:51:45 -07:00
Gary Burd 87f6f6a22e Add documentation about origin policy. 2014-10-12 09:34:51 -07:00
Gary Burd aef42a8ae6 Add note about reading the connection. 2014-07-07 09:33:43 -07:00
Gary Burd df94ef6daa Various improvements to Upgrader.
- Revert back to using Subprotocols []string. The protocol negotiation
  using Subprotocols should meet the needs of most applications.
  Applications are not locked into using this negotiation. An
  application can pick a protocol some other way and specify the
  protocol using the Sec-Websocket-Protocol response header.
- Parse the origin using url.Parse. This is the correct function to use
  when parsing a full URL.
- Improve comments.
2014-04-20 11:38:35 -07:00
Gary Burd 15aed3b4a4 Relicense to the Gorilla WebSocket Authors. 2014-04-18 14:25:11 -07:00
Joachim Bauch ecf9b98e31 Updated docs. 2014-04-18 00:40:10 +02:00
Daniel Darabos 1b37ccbb61 Fix small inconsistency in example. 2014-02-15 13:48:14 +01:00
Mark Dain 30354e97e2 Fixed Examples
- Typo ("conn.WriteMessaage" should be "conn.WriteMessage")
- Fixed Incorrect WriteMessage call:

    func (c *Conn) WriteMessage(messageType int, data []byte) error

But the example uses `_, err` when there is only 1 return type.
2013-12-31 11:00:58 +00:00
Gary Burd 5625e8a51f Fix tabs in overview examples. 2013-12-20 15:57:02 -08:00
Gary Burd 536d8dd066 Fix typo in Upgrade example. 2013-12-20 13:49:38 -08:00
Gary Burd 93b1570a27 Improve documentation.
- Introduce ReadMessage and WriteMessage before NextReader and
  NextWriter in the package comment. It's better to introduce the easy
  methods first.
- Move sections on message of types before the concurrency section.
2013-10-29 17:43:03 -07:00
Gary Burd 273ecadfca Initial commit 2013-10-16 16:30:59 -07:00