The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dancer2::Plugin::WebSocket::Connection - Role tying Plack::App::WebSocket::Connection with the Dancer serializer

VERSION

version 0.1.2

DESCRIPTION

The connection objects used by Dancer2::Plugin::WebSocket are Plack::App::WebSocket::Connection objects augmented with this role.

Attributes

    Serializer object used to serialize/deserialize messages. If it's not undef, all messages that are not AnyEvent::WebSocket::Message objects are assumed to be JSON and will be deserialized before being passed to the handlers, and will be serialized after being give to send.

      A numerical value that is the id of the connection.

Methods

set_channels( @channels )

Set the channels this connection belongs to. In addition to the @channels provided, the connection is always associated to its id channel (which is always numerical) as well as the global channel *.

add_channels( @channels )

Add @channels to the list of channels the connection belongs to.

in_channel( @channels )

Returns true if the connection belongs to at least one of the given @channels.

to( @channels )

Returns a Dancer2::Plugin::WebSocket::Group that will emit messages to all connections belonging to the given @channels.

    $conn->to( 'players' )->send( "game about to begin" );

AUTHOR

Yanick Champoux <yanick@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019, 2017 by Yanick Champoux.

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

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 101:

=over should be: '=over' or '=over positive_number'

Around line 109:

=over should be: '=over' or '=over positive_number'

You can't have =items (as at line 113) unless the first thing after the =over is an =item

Around line 115:

You forgot a '=back' before '=head2'

You forgot a '=back' before '=head2'

Around line 141:

You forgot a '=back' before '=head1'