Permalink
Browse files

Prepare for CPAN

  • Loading branch information...
1 parent 5871db4 commit 912d23c94b0295748e6dd707f6686fb1a8694260 @vti committed Mar 16, 2011
View
4 README.pod
@@ -106,7 +106,7 @@ This middleware is in a very beta stage. API will be probably changed.
=head1 CREDITS
-Socket.IO authors and contributors.
+Socket.IO author(s) and contributors.
=head1 AUTHOR
@@ -117,6 +117,6 @@ Viacheslav Tykhanovskyi, C<vti@cpan.org>.
Copyright (C) 2011, Viacheslav Tykhanovskyi
This program is free software, you can redistribute it and/or modify it under
-the same terms as Perl 5.10.
+the terms of the Artistic License version 2.0.
=cut
View
78 lib/Plack/Middleware/SocketIO.pm
@@ -5,7 +5,7 @@ use warnings;
use base 'Plack::Middleware';
-our $VERSION = '0.00100';
+our $VERSION = '0.00900';
use Plack::Util::Accessor qw(resource handler);
@@ -29,3 +29,79 @@ sub call {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO - Socket.IO middleware
+
+=head1 SYNOPSIS
+
+ use Plack::Builder;
+
+ builder {
+ enable "SocketIO", handler => sub {
+ my $self = shift;
+
+ $self->on_message(
+ sub {
+ my $self = shift;
+ my ($message) = @_;
+
+ ...
+ }
+ );
+
+ $self->send_message({buffer => []});
+ };
+
+ $app;
+ };
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO> is a server implmentation of SocketIO in Perl.
+
+=head2 SocketIO
+
+More information about SocketIO you can find on the website L<http://socket.io/>, or
+on the GitHub L<https://github.com/LearnBoost/Socket.IO>.
+
+=head2 Transports
+
+All the transports are supported.
+
+ WebSocket
+ Adobe(R) Flash(R) Socket
+ AJAX long polling
+ AJAX multipart streaming
+ Forever Iframe
+ JSONP Polling
+
+=head2 TLS/SSL
+
+For TLS/SSL a secure proxy is needed. C<stunnel> or L<App::TLSMe> is
+recommended.
+
+=head1 DEVELOPMENT
+
+=head2 Repository
+
+ http://github.com/vti/plack-middleware-socketio
+
+=head1 CREDITS
+
+Socket.IO author(s) and contributors.
+
+=head1 AUTHOR
+
+Viacheslav Tykhanovskyi, C<vti@cpan.org>.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2011, Viacheslav Tykhanovskyi
+
+This program is free software, you can redistribute it and/or modify it under
+the terms of the Artistic License version 2.0.
+
+=cut
View
34 lib/Plack/Middleware/SocketIO/Base.pm
@@ -50,7 +50,8 @@ sub remove_connection {
my $self = shift;
my ($conn) = @_;
- Plack::Middleware::SocketIO::Resource->instance->remove_connection($conn->id);
+ Plack::Middleware::SocketIO::Resource->instance->remove_connection(
+ $conn->id);
return $self;
}
@@ -128,3 +129,34 @@ sub _build_handle {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::Base - Base class for transports
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::Base> is a base class for the transports.
+
+=head1 METHODS
+
+=head2 C<new>
+
+=head2 C<env>
+
+=head2 C<req>
+
+=head2 C<resource>
+
+=head2 C<add_connection>
+
+=head2 C<remove_connection>
+
+=head2 C<find_connection_by_id>
+
+=head2 C<client_connected>
+
+=head2 C<client_disconnected>
+
+=cut
View
50 lib/Plack/Middleware/SocketIO/Connection.pm
@@ -218,3 +218,53 @@ sub _parse_data {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::Connection - Connection class
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::Connection> is a connection class that
+incapsulates all the logic for bulding and parsing Socket.IO messages.
+
+=head1 METHODS
+
+=head2 C<new>
+
+=head2 C<id>
+
+=head2 C<type>
+
+=head2 C<disconnect>
+
+=head2 C<is_connected>
+
+=head2 C<on>
+
+=head2 C<on_disconnect>
+
+=head2 C<on_error>
+
+=head2 C<on_message>
+
+=head2 C<send_message>
+
+=head2 C<send_broadcast>
+
+=head1 INTERNAL METHODS
+
+=head2 C<connect>
+
+=head2 C<on_write>
+
+=head2 C<read>
+
+=head2 C<send_id_message>
+
+=head2 C<build_id_message>
+
+=head2 C<send_heartbeat>
+
+=cut
View
32 lib/Plack/Middleware/SocketIO/Handle.pm
@@ -114,3 +114,35 @@ sub close {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::Handle - Handle
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::Handle> is a wrapper on top of
+L<AnyEvent::Handle>.
+
+=head1 METHODS
+
+=head2 C<new>
+
+=head2 C<heartbeat_timeout>
+
+=head2 C<on_eof>
+
+=head2 C<on_heartbeat>
+
+=head2 C<on_read>
+
+=head2 C<write>
+
+=head2 C<close>
+
+=head1 SEE ALSO
+
+L<AnyEvent::Handle>
+
+=cut
View
12 lib/Plack/Middleware/SocketIO/Htmlfile.pm
@@ -121,3 +121,15 @@ sub _wrap_into_script {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::Htmlfile - Htmlfile transport
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::Htmlfile> is a C<htmlfile> transport
+implementation.
+
+=cut
View
18 lib/Plack/Middleware/SocketIO/JSONPPolling.pm
@@ -125,3 +125,21 @@ sub _wrap_into_jsonp {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::JSONPPolling - JSONPPolling transport
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::JSONPPolling> is a C<jsonp-polling> transport
+implementation.
+
+=head1 METHODS
+
+=head2 C<name>
+
+=head2 C<finalize>
+
+=cut
View
23 lib/Plack/Middleware/SocketIO/Resource.pm
@@ -112,3 +112,26 @@ sub _build_connection {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::Resource - Resource class
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::Resource> is a singleton connection pool.
+
+=head1 METHODS
+
+=head2 C<instance>
+
+=head2 C<connection>
+
+=head2 C<add_connection>
+
+=head2 C<remove_connection>
+
+=head2 C<finalize>
+
+=cut
View
15 lib/Plack/Middleware/SocketIO/WebSocket.pm
@@ -83,3 +83,18 @@ sub _build_frame {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::WebSocket - WebSocket transport
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::WebSocket> is a WebSocket transport implementation.
+
+=head1 SEE ALSO
+
+L<Protocol::WebSocket>
+
+=cut
View
20 lib/Plack/Middleware/SocketIO/XHRMultipart.pm
@@ -113,3 +113,23 @@ sub _finalize_send {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::XHRMultipart - XHRMultipart transport
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::XHRMultipart> is a C<xhr-multipart> transport
+implementation.
+
+=head1 METHODS
+
+=head2 C<new>
+
+=head2 C<name>
+
+=head2 C<finalize>
+
+=cut
View
18 lib/Plack/Middleware/SocketIO/XHRPolling.pm
@@ -115,3 +115,21 @@ sub _finalize_send {
}
1;
+__END__
+
+=head1 NAME
+
+Plack::Middleware::SocketIO::XHRPolling - XHRPolling transport
+
+=head1 DESCRIPTION
+
+L<Plack::Middleware::SocketIO::XHRPolling> is a C<xhr-polling> transport
+implementation.
+
+=head1 METHODS
+
+=head2 C<name>
+
+=head2 C<finalize>
+
+=cut
View
10 xt/changes.t
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+eval 'use Test::CPAN::Changes';
+
+plan skip_all => 'Test::CPAN::Changes required for this test' if $@;
+
+changes_ok();
View
19 xt/pod-coverage.t
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+ if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+ if $@;
+
+all_pod_coverage_ok();
View
11 xt/pod.t
@@ -0,0 +1,11 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();

0 comments on commit 912d23c

Please sign in to comment.