GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Plack::Middleware::SocketIO(3) User Contributed Perl Documentation Plack::Middleware::SocketIO(3)

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.

resource
    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.

handler
    enable "SocketIO",
        handler => sub {
            my $socket = shift;

            $socket->on_message(sub {
                my $socket = shift;
            });

            $socket->send_message('hello');
        };
    
class or instance, method
    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.

    http://github.com/vti/plack-middleware-socketio

Socket.IO author(s) and contributors.

Viacheslav Tykhanovskyi, "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.

2011-07-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.