Dancer2...nection(3)

πŸ“¦ version 0.3.1, in opensuse-leap 16.0

πŸ’… NAME πŸ’…

Okay bestie, this page is for Dancer2::Plugin::WebSocket::Connection β€” it’s the role that ties Plack::App::WebSocket::Connection together with the Dancer serializer. Iconic behavior, honestly.


✨ VERSION ✨

Version 0.3.1 β€” yes ma’am, that’s the one.


πŸ¦‹ DESCRIPTION πŸ¦‹

The connection objects used by Dancer2::Plugin::WebSocket are Plack::App::WebSocket::Connection objects augmented with this role. That’s the whole lore.

πŸŽ€ Attributes πŸŽ€

  • serializer β€” This is the serializer object used to serialize/deserialize messages. If it’s not undef, then all messages that are not AnyEvent::WebSocket::Message objects are assumed to be JSON. Those get deserialized before being passed to the handlers, and they get serialized after being given to send. Very β€œglow-up on the way in and on the way out” of it.
  • id β€” A numerical value that is the id of the connection. Numbers only, bestie.

πŸ’… Methods πŸ’…

  • set_channels( @channels ) β€” Set the channels this connection belongs to. Besides the @channels you provide, the connection is always associated with its id channel β€” which is always numerical β€” and also the global channel "*". She contains multitudes.
  • add_channels( @channels ) β€” Add @channels to the list of channels the connection belongs to. Just adding to the group chat.
  • in_channel( @channels ) β€” Returns "true" if the connection belongs to at least one of the given @channels. A vibe check for channels, basically.
  • to( @channels ) β€” Returns a Dancer2::Plugin::WebSocket::Group that will emit messages to all connections belonging to the given @channels. Like so:
$conn->to( 'players' )->send( "game about to begin" );

πŸ‘‘ AUTHOR πŸ‘‘

Yanick Champoux <yanick@cpan.org>


This software is copyright (c) 2021, 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.


And that’s the whole page, bestie. This little beauty came from the perl v5.42.0 docs, dated 2021-05-31, and it’s the Dancer2...nection(3) manual page. Slay and goodbye πŸ’–βœ¨

πŸ“¦ where this page comes from