Net::Async::ControlChannel::Server - server implementation for Protocol::ControlChannel using IO::Async
Version 0.005
use Net::Async::ControlChannel::Server; use IO::Async::Loop; my $loop = IO::Async::Loop->new; my $server = Net::Async::ControlChannel::Server->new( loop => $loop, ); $server->subscribe_to_event( message => sub { my $ev = shift; my ($k, $v, $from) = @_; warn "Server: Had $k => $v from $from\n"; } ); $server->start; $loop->run;
Provides the server half for a control channel connection.
Instantiates the server object. Will not establish the listener, but does expect to receive an IO::Async::Loop as the loop named parameter.
loop
The IO::Async::Loop instance we're (going to be) attached to.
Our host. Will be populated after "start" has been called.
Our listening port. Will be populated after "start" has been called.
The Protocol::ControlChannel instance. Mainly for internal use.
All currently-connected clients, as a list.
Sends a message to all clients.
Expects two parameters:
$k - the key we're sending
$v - the content (can be a ref, in which case it will be encoded using whichever mechanism has been negotiated with the client)
Returns a Future which will resolve when we think we've delivered to all connected clients.
Start the listener. Will return a Future which resolves with our instance once the listening socket is active.
The Future corresponding to the listening connection. Resolves with our instance.
Called internally when the listen action is complete.
Called when there's an error. Marks "listening" as failed.
Called internally for each incoming client.
Called internally when we have data from a client.
add_handler_for_event, clear_event_handlers, event_handlers, invoke_event, subscribe_to_event, unsubscribe_from_event
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2012-2013. Licensed under the same terms as Perl itself.
To install Net::Async::ControlChannel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::ControlChannel
CPAN shell
perl -MCPAN -e shell install Net::Async::ControlChannel
For more information on module installation, please visit the detailed CPAN module installation guide.