Skip to content

Commit

Permalink
Add an FAQ entry explaining how to use permessage-deflate in 0.6.0 an…
Browse files Browse the repository at this point in the history
…d 0.7.0
  • Loading branch information
Peter Thorson committed Feb 18, 2016
1 parent 931ad40 commit 9dc013a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docs/faq.dox
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,51 @@ Whether an Asio endpoint uses TLS or not is determined by its config template pa
The `<websocketpp/config/asio.hpp>` and `<websocketpp/config/asio_client.hpp>` headers will include both the TLS and non-TLS varients of their respective configs and require the presence of OpenSSL. The `<websocketpp/config/asio_no_tls.hpp>` and `<websocketpp/config/asio_no_tls_client.hpp>` headers will include only the non-TLS configs and do not require OpenSSL.


## Compression

### How do I use permessage-deflate in version 0.6.0-permessagedeflate and 0.7.0?

These versions of the library require a custom config to use the permessage-deflate extension. Here is a minimal example of such a custom config. You can also integrate these lines into an existing custom config.

Note that in these versions there is no fine grained control over which connections are compressed or not. Clients will request compression with the default settings and use it if the server supports it. Servers will accept whatever parameters clients request.

Outgoing messages by default will be compressed if compression was auto-negotiated during the handshake. There is an option to force a specific message to be sent uncompressed even if compression was negotiated. This may be useful for sending data that you know to be compressed already (images, zip files, etc).


__Server Example__
```
#include <websocketpp/extensions/permessage_deflate/enabled.hpp>

struct deflate_server_config : public websocketpp::config::asio {
// ... additional custom config if you need it for other things

/// permessage_compress extension
struct permessage_deflate_config {};

typedef websocketpp::extensions::permessage_deflate::enabled
<permessage_deflate_config> permessage_deflate_type;
};

typedef websocketpp::server<deflate_server_config> server_endpoint_type;
```

__Client Example__
```
#include <websocketpp/extensions/permessage_deflate/enabled.hpp>

struct deflate_client_config : public websocketpp::config::asio_client {
// ... additional custom config if you need it for other things

/// permessage_compress extension
struct permessage_deflate_config {};

typedef websocketpp::extensions::permessage_deflate::enabled
<permessage_deflate_config> permessage_deflate_type;
};

typedef websocketpp::client<deflate_client_config> client_endpoint_type;
```

## Security

### Is it possible to terminate a malicious connection quickly, without tying up resources performing clean close steps,
Expand Down

0 comments on commit 9dc013a

Please sign in to comment.