The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::WebSocket::Streamer::Server

SYNOPSIS

    open my $rfh, '<', '/some/big/file';

    my $stream = Net::WebSocket::Streamer::Server->new('binary');

    while ( read $rfh, my $buf, 32768 ) {
        my $chunk = $stream->create_chunk($buf);
        print {$socket} $chunk->to_bytes();
    }

    print {$socket} $stream->create_final(q<>);

DESCRIPTION

The SYNOPSIS pretty well shows it: you can use this module (or its twin, Net::WebSocket::Streamer::Client) to send a WebSocket message without buffering the full contents.

EXTENSION SUPPORT

You can subclass this module to support initial frame types other than text or binary. (Subsequent frames are always continuations.)

You can also set the reserved bytes manually on the individual frames to support extensions that involve those bits.