Net::WebSocket::PMCE::deflate::Server - permessage-deflate for a server
my $deflate = Net::WebSocket::PMCE::deflate::Server->new( %opts ); #You’ll probably want Net::WebSocket::Handshake #to do this for you, but just in case: #$deflate->consume_parameters( @params_kv ); #OPTIONAL: Inspect $deflate to be sure you’re happy with the setup #that the client’s parameters allow. #Send this to the client. my $handshake = $deflate->create_handshake_object(); #...and now use this to send/receive messages. my $data_obj = $deflate->create_data_object();
The above should describe the workflow sufficiently.
The optional “inspection” step is to ensure that you’re satisfied with the compression parameters, which may be different now from what you gave to the constructor.
For example, if you do this:
my $deflate = Net::WebSocket::PMCE::deflate::Server->new( inflate_max_window_bits => 10, );
… and then this has no
$deflate->consume_parameters( @extn_objs );
… then that means the client doesn’t understand
client_max_window_bits, which means we can’t send that parameter. When this happens,
$deflate changes to return 15 rather than 10 from its
In general this should be fine, but if, for some reason, you want to insist that the client compress with no more than 10 window bits, then at this point you can fail the connection.
Inherited from the base class. The alterations made in response to the different parameters are:
<client_no_context_takeover> - Sets the object’s
<server_no_context_takeover> - Sets the object’s
<client_max_window_bits> - If given and less than the object’s
inflate_max_window_bitsoption, then that option is reduced to the new value.
<server_max_window_bits> - If given and less than the object’s
deflate_max_window_bitsoption, then that option is reduced to the new value.