The Cro::WebSocket::Frame class represents WebSocket frame as defined per RFC 6455. The frame is assumed to be already unmasked/masked on parser/serializer level.

It exports Opcode enum that consists of possible frame opcodes, they are:

  • Continuation(0)

  • Text(1)

  • Binary(2)

  • Close(8)

  • Ping(9)

  • Pong(0)

It can be used with full name qualification as follows

my $opcode = Cro::WebSocket::Frame::Opcode(0);


The class has three attributes, all of them are marked as rw;


fin class attribute is a Bool flag that indicates whether this message final or not.


opcode class attribute describes frame opcode.


payload is a Blob that contains Payload Data part of the frame. Payload is treated as a single blob, i.e. there is no distinction between Extension data and Application data on this level.