NAME
POE::Component::Lightspeed::Server - The "hubs" of the Lightspeed network
SYNOPSIS
use POE;
use POE::Component::Lightspeed::Server;
POE::Component::Lightspeed::Server->spawn(
'ALIAS' => 'myclient',
'KERNEL' => 'mybox',
'ADDRESS' => 'localhost',
'PORT' => 5634,
'SERIALIZERS' => [ qw( MySerializer Storable ) ],
'COMPRESSION' => 1,
) or die "Unable to create Server session!";
# Communicate with the rest of the network once they connect!
ABSTRACT
The Lightspeed Server session
DESCRIPTION
This module listens for connections from remote Lightspeed clients. Usage is exactly the same as described in the Lightspeed documentation.
Starting Lightspeed::Server
To start the server, just call it's spawn method:
POE::Component::Lightspeed::Server->spawn(
'ALIAS' => 'myclient',
'KERNEL' => 'mybox',
'ADDRESS' => 'localhost',
'PORT' => 5634,
'SERIALIZERS' => [ qw( MySerializer Storable ) ],
'COMPRESSION' => 1,
) or die "Unable to create Server session!";
This method will return undef on error or return success.
This constructor accepts only 8 options.
ADDRESS
-
The address to listen on.
This is the only MANDATORY argument.
ALIAS
-
This will set the alias this client session uses in the POE Kernel.
This will default to "lightspeed_server" or "lightspeed_serverX" where x is a number sequence.
PORT
-
The port to listen on.
This will default to '9876'.
KERNEL
-
The descriptive name of the local kernel.
This will default to $POE::Kernel::poe_kernel->ID().
SERIALIZERS
-
This should be an arrayref of serializers to use
This will default to: [ qw( Storable YAML ) ]
COMPRESSION
-
This is the boolean option passed to POE::Filter::Reference
This will default to false ( 0 )
SSLKEYCERT
-
This should be an arrayref of 2 elements: - the public key location - certificate location
Supplying this argument will make the connections use SSL encryption.
This will default to nothing, and not use SSL at all.
PASSWORD
-
The password for the server, used in the connection stage.
This will default to nothing.
AUTHCLIENT
-
This should be a subroutine reference which will be asked whether to accept a new connection or not.
Arguments: - local address - local port - remote address - remote port Should return a boolean true/false if the client is accepted or not
This will default to nothing.
Usage
The Server session will listen for connections and announce them to the Lightspeed network. Then, message-passing operations can BEGIN!
It's pretty strict about the initial connection to the client, and will disconnect them if it finds any errors.
Commands
There's only one command you can send: the shutdown event.
Keep in mind that you need the alias of the session if you have several of them running!
$kernel->post( 'lightspeed_server', 'shutdown' );
Notes
This module is very picky about capitalization!
All of the options are uppercase, to avoid confusion.
You can enable debugging mode by doing this:
sub POE::Component::Lightspeed::Server::DEBUG () { 1 }
use POE::Component::Lightspeed::Server;
EXPORT
Nothing.
SEE ALSO
AUTHOR
Apocalypse <apocal@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2005 by Apocalypse
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.