AnyEvent::WebSocket::Message(3pm)

AnyEvent::WebSocket::Message3pm

Websocket message for anyevent

Usage

 $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;
   }
 });

Version

version 0.55

Overview

Instances of this class represent a single WebSocket message. They are the objects that come through from the other end of your AnyEvent::WebSocket::Connection instance. They can also be sent through that class using its "send" method.

Attributes

body

The body or payload of the message.

opcode

The integer code for the type of message.

Methods

decoded_body

 my $body = $message->decoded_body;

Returns the body decoded from UTF-8.

is_text

 my $bool = $message->is_text;

True if the message is text.

is_binary

 my $bool = $message->is_binary;

True if the message is binary.

is_close

 my $bool = $message->is_close;

True if the message is a close message.

is_ping

 my $bool = $message->is_ping

True if the message is a ping.

is_pong

 my $bool = $message->is_pong;

True if the message is a pong.

Releases

3 releases since Debian 11 (Bullseye); the text changed 1 time.

  1. 11–12
  2. 13

Author

Author: Graham Ollis <[email protected]>

Contributors:

Toshio Ito (debug-ito, TOSHIOITO)

José Joaquín Atria (JJATRIA)

Kivanc Yazan (KYZN)

Yanick Champoux (YANICK)

Fayland Lam (FAYLAND)

Daniel Kamil Kozar (xavery)

From libanyevent-websocket-client-perl 0.55-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.