A plugin can define any of the methods below. All are optional, but a plugin should have a conncted and a receive method for it to function. See the Sprocket site for examples. http://sprocket.cc/ Plugins should use the template in the SYNOPSIS.

Called with ( $self, $server, $con, $socket ) Defining this method is optional. The default behavior is to accept the connection. You can call $con->reject() or $con->accept() to reject or accept a connection. You can also call $self->take_connection( $con ); in this phase. See Sprocket::Connection for more information on the accept and reject methods.

Called with ( $self, $server, $con, $socket ) This is the last chance for a plugin to take a connection with $self->take_connection( $con ); You should apply your filters for the connection in this method. See Sprocket::Connection for details on how to access the connection's filters.

Called with ( $self, $server, $con, $error ) If error is true, then $operation, $errnum, and $errstr will also be defined after $error. If a connection was closed with $con->close() then $error will be false. If a connection was closed remotely but without an error then $error will be true, but $errnum will be 0. For more details, see ErrorEvent in POE::Wheel::ReadWrite.

Called with ( $self, $server, $operation, $errnum, $errstr ) This is only called when there is an error with the server wheel, like a bind error. ( $errnum will == EADDRINUSE, after: use Errno qw( EADDRINUSE ); ) The default behavior will be to shutdown the server if there is a bind error.

Called with ( $self, $server, $con, $time ) A time out occurred on the connection. This means the $con->active_time + $con->time_out is less than $time. You can choose to $con->close() or not. The default behavior is to close the connection. This event will only occur if you have set a time out with $con->set_time_out( $seconds )

Called with ( $self, $server, $con ) This is currently only called when a soft shutdown is initiated. You should make cleanup arrangements and close the connection asap. The server will wait for all connections to close. See the shutdown command in Sprocket::Server, and Sprocket::Client.

Called with ( $self, $client, $con ) If a connection wasn't attempted due to a DNS issue, $response_error, and $response_obj from POE::Component::DNS will follow $con. The remote_disconnected event will not be called. You can call $con->reconnect() to attempt to reconnect to the host.

Called with ( $self, $client, $con, $time ) A time out occurred on the connection. This means the $con->active_time + $con->time_out is less than $time. You can choose to $con->close() or not. The default behavior is to close the connection. This event will only occur if you have set a time out with $con->set_time_out( $seconds )

Returns a list of connection ids currently active conenctions taken by the plugin. Use $sprocket->get_connection() to get the connection reference. Note: con_id_list in a scalar context will return an array ref