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.
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.
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.
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.
- 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.
- 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.
- 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.