-
-
28 Feb 2013 22:33:02 UTC
- Distribution: Net-Async-WebSocket
- Module version: 0.06
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (8)
- Testers (188 / 3 / 0)
- Kwalitee
Bus factor: 1- License: perl_5
- Activity
24 month- Tools
- Download (14.72KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Net::Async::WebSocket::Client
- connect to a WebSocket server usingIO::Async
SYNOPSIS
use IO::Async::Loop; use Net::Async::WebSocket::Client; my $client = Net::Async::WebSocket::Client->new( on_frame => sub { my ( $self, $frame ) = @_; print $frame; }, ); my $loop = IO::Async::Loop->new; $loop->add( $client ); $client->connect( host => $HOST, service => $PORT, url => "ws://$HOST:$PORT/", on_connected => sub { $client->send_frame( "Hello, world!\n" ); }, on_connect_error => sub { die "Cannot connect - $_[-1]" }, on_resolve_error => sub { die "Cannot resolve - $_[-1]" }, ); $loop->loop_forever;
DESCRIPTION
This subclass of Net::Async::WebSocket::Protocol connects to a WebSocket server to establish a WebSocket connection for passing frames.
METHODS
$self->connect( %params )
Connect to a WebSocket server. Takes the following named parameters:
- transport => IO::Async::Stream
-
The underlying transport to use for this connection.
- url => STRING
-
URL to provide to WebSocket handshake
- on_connected => CODE
-
CODE reference to invoke when the handshaking is complete.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
Module Install Instructions
To install Net::Async::WebSocket, copy and paste the appropriate command in to your terminal.
cpanm Net::Async::WebSocket
perl -MCPAN -e shell install Net::Async::WebSocket
For more information on module installation, please visit the detailed CPAN module installation guide.