SetCompressionLevel sets the flate compression level for subsequent text and binary messages. This function is a noop if compression was not negotiated with the peer. See the compress/flate package for a description of compression levels.
(level int)
| 1215 | // with the peer. See the compress/flate package for a description of |
| 1216 | // compression levels. |
| 1217 | func (c *Conn) SetCompressionLevel(level int) error { |
| 1218 | if !isValidCompressionLevel(level) { |
| 1219 | return errors.New("websocket: invalid compression level") |
| 1220 | } |
| 1221 | c.compressionLevel = level |
| 1222 | return nil |
| 1223 | } |
| 1224 | |
| 1225 | // FormatCloseMessage formats closeCode and text as a WebSocket close message. |
| 1226 | // An empty message is returned for code CloseNoStatusReceived. |