POEx::ProxySession::Server - Hosts published sessions and routes proxy message
version 1.102760
class Flarg { with 'POEx::Role::SessionInstantiation';
after _start(@args) is Event { POEx::ProxySession::Server->new ( listen_ip => '127.0.0.1', listen_port => 56789, alias => 'Server', options => { trace => 1, debug => 1 }, ); } }
POEx::ProxySession::Server is a lightweight network server that handles storage and listing of published sessions, and routing of proxied messages between connected clients.
This attribute is used to store the published sessions.
Access these sessions through the following methods:
The stored structure looks like the following:
Session => { name => isa SessionAlias, methods => isa HashRef, id => isa WheelID, }
delivered_store holds the wheel ids that are awaiting a response from some other client.
Access to these ids is provided through the following methods:
handles => { get_delivered => 'get', set_delivered => 'set', delete_delivered => 'delete', count_delivereds => 'count', all_delivered_keys => 'keys', all_delivered_values => 'values', has_delivered => 'exists', }
(ProxyMessage $data, WheelID $id) is Event
Our implementation of handle_inbound_data expects a ProxyMessage as data. Here is where the handling and routing of messages lives. The following types of messages are handled here: publish, rescind, listing, subscribe, deliver, and result.
This handles rescinding of a published session. No payload on success.
This method handles session publication. Payload on success is the session alias
This method handles subscription requests. Payload on success is a hashref:
Payload => { session => isa SessionAlias, methods => HashRef, }
This method does message delivery by doing a lookup of the alias to the real session name, and rewriting the message header to point to that session, then sends it on to that session's connection. Sets a delivered message.
This method handles result messages from delivered messages. All messages that go through the system are expected to return a result message indicating success or failure.
This method handles listing requests from clients. Should always succeed. Payload is an ArrayRef[SessionAlias].
(@args) is Event
The _start method is advised to hardcode the filter to use as a POE::Filter::Reference instance.
Nicholas Perez <nperez@cpan.org>
This software is copyright (c) 2010 by Nicholas Perez.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install POEx::ProxySession, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POEx::ProxySession
CPAN shell
perl -MCPAN -e shell install POEx::ProxySession
For more information on module installation, please visit the detailed CPAN module installation guide.