NAME

AnyEvent::WebSocket::Message - WebSocket message for AnyEvent

VERSION

version 0.29

SYNOPSIS

$connection->send(
  AnyEvent::WebSocket::Message->new(body => "some message"),
);

$connection->on(each_message => sub {
  my($connection, $message) = @_;
  if($message->is_text || $message->is_binary)
  {
    my $body = $message->body;
  }
});

DESCRIPTION

Instances of this class represent a message passed through the WebSocket from the other end.

ATTRIBUTES

body

The body or payload of the message.

opcode

The integer code for the type of message.

METHODS

$message->decoded_body

Returns the body decoded from UTF-8.

$message->is_text

True if the message is text.

$message->is_binary

True if the message is binary.

$message->is_close

True if the message is a close message.

$message->is_ping

True if the message is a ping.

$message->is_pong

True if the message is a pong.

SEE ALSO

AUTHOR

author: Graham Ollis <plicease@cpan.org>

contributors:

Toshio Ito

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.