The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Kelp::Module::WebSocket::AnyEvent::Connection - Thin wrapper around Plack::App::WebSocket::Connection

SYNOPSIS

        my $id = $connection->id;
        $connection->data->{test} = 'custom data';

        $connection->send('hello there');

DESCRIPTION

Connection objects of this class fly around in Kelp::Module::WebSocket::AnyEvent. Refer to its documentation for details

ATTRIBUTES

id

an autoincremented identifier.

manager

an instance of Kelp::Module::WebSocket::AnyEvent (weakened).

connection

an instance of Plack::App::WebSocket::Connection (weakened).

data

custom data, a hash by default. Can be written by specifying the first argument.

METHODS

new

a Kelp-style constructor.

send

sends data to the websocket peer.

close

closes the connection gracefully.