CLASS->new( %OPTS )
%OPTS is:
deflate_max_window_bits
- optional; the number of window bits to use for compressing messages. This should correspond with the local endpoint’s behavior; i.e., for a server, this should match theserver_max_window_bits
extension parameter in the WebSocket handshake.inflate_max_window_bits
- optional; the number of window bits to use for decompressing messages. This should correspond with the remote peer’s behavior; i.e., for a server, this should match theclient_max_window_bits
extension parameter in the WebSocket handshake.deflate_no_context_takeover
- corresponds to either theclient_no_context_takeover
orserver_no_context_takeover
parameter, to match the local endpoint’s role. When this flag is set, the object will do a full flush at the end of eachcompress()
call.
$msg = OBJ->create_message( FRAME_TYPE, PAYLOAD )
Creates an unfragmented, compressed message. The message will be an instance of Net::WebSocket::Message.
FRAME_TYPE can be either text
or binary
(for Net::WebSocket’s default frame classes) or full package names (e.g., to use a custom frame class).
This method cannot be called while a streamer object has yet to create its final frame.
NOTE: This function alters PAYLOAD.
$msg = OBJ->create_streamer( FRAME_TYPE )
FRAME_TYPE can be either text
or binary
(for Net::WebSocket’s default frame classes) or full package names (e.g., to use a custom frame class).
Returns an instance of Net::WebSocket::PMCE::deflate::Data::Streamer based on this object.
$decompressed = OBJ->decompress( COMPRESSED_PAYLOAD )
Decompresses the given string and returns the result.
NOTE: This function alters COMPRESSED_PAYLOAD, such that it’s probably not useful afterward.