NAME
MsgPack::RPC::Message::Request - a MessagePack-RPC request
VERSION
version 2.0.2
SYNOPSIS
use MsgPack::RPC;
my $rpc = MsgPack::RPC->new( io => '127.0.0.1:6543' );
$rpc->emit( some_request => 'MsgPack::RPC::Message::Request', args => [ 1..5 ] );
DESCRIPTION
Sub-class of MsgPack::RPC::Message representing an incoming request.
METHODS
new( args => $args, message_id => $id )
Accepts the same argument as MsgPack::RPC::Message, plus message_id
, the id of the request.
response
Returns a Promises::Deferred that, once fulfilled, sends the response back with the provided arguments.
$rpc->subscribe( something => sub {
my $request = shift;
$request->response->resolve('a-okay');
});
resp($args)
Shortcut for
$request->response->resolve($args)
error($args)
Shortcut for
$request->response->reject($args)
AUTHOR
Yanick Champoux <yanick@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019, 2017, 2016, 2015 by Yanick Champoux.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.