++ed by:
SKOLYCHEV TEAM

2 PAUSE users
1 non-PAUSE user.

Author image Felipe Gasper
and 1 contributors

NAME

Net::WebSocket::Defragmenter

SYNOPSIS

    my $defragger = Net::WebSocket::Defragmenter->new(
        parser => $parser_obj,  #i.e., isa Net::WebSocket::Parser

        #Optional; these two receive the Net::WebSocket::Frame object.
        on_control_frame => sub { ... },
        on_data_frame => sub { ... },

        #Optional; receives a type string and a human-readable message.
        #An exception is thrown after this callback runs.
        on_protocol_error => sub { ... },
    );

    my $msg_or_undef = $defragger->get_next_message();

DESCRIPTION

You ordinarily shouldn’t instantiate this class because Net::WebSocket::Endpoint already uses it.

This class implements WebSocket’s defragmentation logic. It’s mostly meant for internal use but is documented for cases where Net::WebSocket::Endpoint may not be usable or desirable.

METHODS

CLASS->new( %OPTS )

See SYNOPSIS above.

OBJ->get_next_message()

Reads a frame from parser.

Returns a Net::WebSocket::Message object if there is a message ready to return; otherwise returns undef.

An exception (Net::WebSocket::X) is thrown on fragmentation errors.