![]() |
![]()
| ![]() |
![]()
NAMERPC::ExtDirect::Event - Asynchronous server-to-client events SYNOPSISuse RPC::ExtDirect; use RPC::ExtDirect::Event; sub foo : ExtDirect(pollHandler) { my ($class) = @_; # Do something good, collect results in $good_data my $good_data = { ... }; # Do something bad, collect results in $bad_data my $bad_data = [ ... ]; # Return the data as a list (not arrayref!) return ( RPC::ExtDirect::Event->new('good', $good_data), RPC::ExtDirect::Event->new( name => 'bad', data => $bad_data, ), ); } DESCRIPTIONThis module implements Event object that is used to send asynchronous events from server to client via periodic polling. Data can be anything that is serializable to JSON. No checks are made and it is assumed that client side can understand the data format used with Events. Note that by default JSON will blow up if you try to feed it a blessed object as data payload, and for very good reason: it is not obvious how to serialize a self-contained object. To avoid this, set a global Config option json_options to include "allow_blessed" flag: my $config = RPC::ExtDirect->get_api->config; $config->json_options({ allow_blessed => 1, }); METHODS
|