Chandra
view release on metacpan or search on metacpan
lib/Chandra/Socket/Client.pm view on Meta::CPAN
(Required) Client name sent during the handshake. Must be unique per Hub.
=item hub
(Required for Unix transport) Name of the Hub to connect to (matches the
Hub's C<name> parameter).
=item transport
C<'unix'> (default) or C<'tcp'>.
=item host
Hub host for TCP. Defaults to C<'127.0.0.1'>.
=item port
(Required for TCP) Hub port number.
=item token
Authentication token. For Unix sockets this is read from the token file
automatically. For TCP it must be provided (see C<< $hub->token >>).
=item tls
Set to a true value to connect via TLS. Requires L<IO::Socket::SSL>.
=item tls_ca
Path to a CA certificate file for server verification. When omitted, peer
verification is disabled.
=back
=head1 METHODS
=head2 on
$client->on($channel => sub { my ($data) = @_; ... });
Register a handler for messages on C<$channel>.
=head2 send
$client->send($channel, \%data);
Send a message to the Hub.
=head2 request
$client->request($channel, \%data, sub { my ($reply) = @_; ... });
Send a request and register a callback for the correlated reply.
=head2 is_connected
if ($client->is_connected) { ... }
Returns true if the underlying connection is alive.
=head2 poll
$client->poll;
Non-blocking check for incoming messages. Triggers auto-reconnect if
the connection has dropped.
=head2 reconnect
$client->reconnect;
Close the current connection (if any) and attempt to reconnect with
exponential back-off.
=head2 close
$client->close;
Close the connection.
=head1 SEE ALSO
L<Chandra::Socket::Hub>, L<Chandra::Socket::Connection>, L<Chandra::App>
=cut
( run in 0.720 second using v1.01-cache-2.11-cpan-39bf76dae61 )