Protocol::WebSocket::Fast::Message - WebSocket Message class
The class represents a message received via WebSocket protocol.
You cannot instantiate an object of the class direcly, it can be accessed via Protocol::WebSocket::Fast::MessageIterator or Protocol::WebSocket::Fast::Parser.
You cannot modify Message object, all provided methods are read only.
Returns undef if there were no errors during parsing the message.
Otherwise returns an XS::ErrorCode object which represents Perl API for convenient C++ std::error_code subsystem. Possible errors are described in Protocol::WebSocket::Fast::Error and Protocol::HTTP::Error.
std::error_code
my $message = $message_iterator->next; if ($message->error) { if ($message->error == Protocol::WebSocket::Fast::Error::invalid_opcode) { ... } elsif ($message->error == Protocol::WebSocket::Fast::Error::max_frame_size) { ... } else { ... } }
The opcode value for the current message
See constants in Protocol::WebSocket::Fast.
True if the message is a control message (consists of single control frame)
Returns unpacked payload size, i.e. if payload was compressed, it will return size of uncompressed payload.
Returns payload as string
If this message is a close message, returns its close code, see Protocol::WebSocket::Fast for constants.
close message
If this message is a close message, returns message assiciated with the close code.
Returns number of frames in the message
Protocol::WebSocket::Fast
Protocol::WebSocket::Fast::Frame
Protocol::WebSocket::Fast::MessageIterator
Protocol::WebSocket::Fast::Parser
rfc6455
To install Protocol::WebSocket::Fast, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Protocol::WebSocket::Fast
CPAN shell
perl -MCPAN -e shell install Protocol::WebSocket::Fast
For more information on module installation, please visit the detailed CPAN module installation guide.