Plack::Middleware::SocketIO - Socket.IO middleware DEPRECATED
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; }; # or builder { enable "SocketIO", class => 'MyApp::Handler', method => 'run'; $app; };
DEPRECATED. Use PocketIO instead http://github.com/vti/pocketio.
Plack::Middleware::SocketIO is a server implmentation of SocketIO in Perl.
More information about SocketIO you can find on the website http://socket.io/, or on the GitHub https://github.com/LearnBoost/Socket.IO.
All the transports are supported.
WebSocket Adobe(R) Flash(R) Socket AJAX long polling AJAX multipart streaming Forever Iframe JSONP Polling
For TLS/SSL a secure proxy is needed. stunnel or App::TLSMe is recommended.
stunnel
enable "SocketIO", resource => 'socket.io', ...;
Specifies the path prefix under which all the requests are handled. This is done so the rest of your application won't interfere with Socket.IO specific calls.
enable "SocketIO", handler => sub { my $socket = shift; $socket->on_message(sub { my $socket = shift; }); $socket->send_message('hello'); };
enable "SocketIO", class => 'MyHandler', method => 'run'; # or enable "SocketIO", instance => MyHandler->new(foo => 'bar'), method => 'run'; package MyHandler; sub new { ... } # or use Moose, Boose, Goose, Doose sub run { my $self = shift; return sub { # same code as above } }
Loads class using Plack::Util::load_class, creates a new object or uses a passed instance and runs run method expecting it to return an anonymous subroutine.
class
instance
run
http://github.com/vti/plack-middleware-socketio
Socket.IO author(s) and contributors.
Viacheslav Tykhanovskyi, vti@cpan.org.
vti@cpan.org
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.
To install Plack::Middleware::SocketIO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::SocketIO
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::SocketIO
For more information on module installation, please visit the detailed CPAN module installation guide.