NAME

Net::WebSocket::PMCE::deflate::Data::Streamer

SYNOPSIS

my $streamer = $deflate_data->create_streamer( $frame_class );

#These frames form a single compressed message in three
#fragments whose content is “onetwothree”.
my @frames = (
    $streamer->create_chunk('one'),
    $streamer->create_chunk('two'),
    $streamer->create_final('three'),
);

DESCRIPTION

This class implements fragmentation for the permessage-deflate WebSocket extension. It allows you to send a single message in arbitrarily many parts. The class is not instantiated directly, but instances are returned as the result of Net::WebSocket::PMCE::deflate::Data’s create_streamer() method.

Strictly speaking, this is a base class; the ::Client and ::Server subclasses implement a bit of logic specific to either endpoint type.

The create_chunk() and create_final() methods follow the same pattern as Net::WebSocket::Streamer.

METHODS

OBJ->create_chunk( OCTET_STRING )

Compresses OCTET_STRING. The compressor doesn’t necessarily produce output from this, however. If the compressor does produce output, then this method returns a frame object (an instance of either the streamer’s assigned frame class or Net::WebSocket::Frame::continuation); otherwise, undef is returned.

OBJ->create_final( OCTET_STRING )

Compresses OCTET_STRING and flushes the compressor. The output matches that of create_chunk() except that the output is always a frame object. The output of this method will complete the message.