NAME

Sprocket - A pluggable POE based Client / Server Library

SYNOPSIS

See examples

ABSTRACT

Sprocket is an POE based networking library that uses plugins similar to POE Components.

DESCRIPTION

Sprocket uses a single session for each object/component created to increase speed and reduce the memory footprint of your apps. Sprocket is used in the Perl version of Cometd http://cometd.com/

NOTES

Sprocket is fully compatable with other POE Compoents. Apps are normally written as Sprocket plugins and paired with a Sprocket::Server or Sprocket::Client.

Sprocket's callbacks are different from POE::Session's callbacks. The params are stacked, and not stuffed into two array refs.

Sprocket observer hooks are usable from any module by using Sprocket.

METHODS

shutdown_all( $type )

Shuts down all sprocket components. $type is optional, and accepts only one type: 'soft' This method is short hand for calling shutdown() on every component. See Sprocket::Client, and Sprocket::Server for shutdown mechanics.

callback( $session_id, $event, @etc )

Returns a callback tied to the $session_id. Extra params (@etc) are optional. For callbacks that are specific to a connection, see Sprocket::Connection

postback( $session_id, $event, @etc )

Returns a postback tied to the $session_id. Extra params (@etc) are optional. For postbacks that are specific to a connection, see Sprocket::Connection

register_hook( $hook_name )

Register one or more hooks for the callback system. You should follow this convention: 'sprocket.foo.bar.action' See HOOKS in Sprocket::Server Sprocket::Client, and below as a template. $hook_name can also be an array ref of hook names.

attach_hook( $hook_name, $callback )

Attach to a callback. A hook does not need to be registered to be used, but SHOULD be registered for good style points. :) $hook_name can also be an array ref of hook names. Returns a UUID for this attached set of hooks.

remove_hook( $uuid )

Removes one or more attached hooks using the uuid returned by attach_hook.

broadcast( $hook_name, $data )

Broadcast a hash ref of $data to observers of $hook_name. $data will be blessed into the package Sprocket::Event. Expect $data to be modified in place.

run()

The same as $poe_kernel->run(); See POE::Kernel.

HOOKS

sprocket.component.add
sprocket.component.remove
sprocket.plugin.add
sprocket.plugin.remove
sprocket.shutdown

SEE ALSO

POE, Sprocket::Connection, Sprocket::Plugin, Sprocket::Server, Sprocket::Client, Sprocket::AIO, Sprocket::Server::PreFork, Sprocket::Logger::Basic, Sprocket::Util::Observable, Sprocket::Event, Sprocket::Util::FDpasser

http://cpantools.com/

AUTHOR

David Davis <xantus@cpan.org>

RATING

Please rate this module. http://cpanratings.perl.org/rate/?distribution=Sprocket

COPYRIGHT AND LICENSE

Copyright 2006-2007 by David Davis

Same as Perl, see the LICENSE file.