| Home | Libraries | People | FAQ | More

###### websocket::stream::compress (1 of 2 overloads)

Set the compress message write option.

###### Synopsis

    void
    compress(
        bool value);

###### Description

This controls whether or not outgoing messages should be compressed. The setting is only applied when

- The template parameter `deflateSupported` is true
- Compression is enable. This is controlled with `stream::set_option`
- Client and server have negotiated permessage-deflate settings
- The message is larger than `permessage_deflate::msg_size_threshold`

This function permits adjusting per-message compression. Changing the opcode after a message is started will only take effect after the current message being sent is complete.

The default setting is to compress messages whenever the conditions above are true.

###### Parameters

Name | Description
--- | ---
`value` | `true` if outgoing messages should be compressed

###### Example

Disabling compression for a single message.

    ws.compress( false );
    ws.write(net::buffer(s), ec);
    ws.compress( true );