NAME
Net::WAMP::Role::Dealer - Dealer role for Net::WAMP
SYNOPSIS
package MyRouter;
use parent qw( Net::WAMP::Role::Dealer );
#For security, this defaults to rejecting everything!
sub deny_CALL {
my ($self, $CALL_msg) = @_;
my $session_obj = $self->get_session();
#success
return;
#fail, generic (Error = wamp.error.not_authorized)
return 1;
#fail, custom Auxiliary (Error = wamp.error.not_authorized)
return { foo => 1 };
#fail, generic Auxiliary, custom Error
return 1, 'myapp.error.go_away';
#fail, custom Auxiliary and Error
return { foo => 1 }, 'myapp.error.go_away';
}
#This follows the same pattern as deny_CALL().
#It also defaults to rejecting everything.
sub deny_REGISTER { ... }
DESCRIPTION
This is an EXPERIMENTAL WAMP Dealer implementation. If you use it, please send feedback!
AUTHORIZATION
To have a useful Dealer you’ll need to create a deny_CALL
method, since the default is to deny all CALL requests. If that Broker is to allow REGISTER requests, you’ll also need a deny_REGISTER()
method. The format of these is described above.
METHODS
Dealer only exposes a few public methods:
$registr_id = OBJ->register( SESSION_OBJ, METADATA_HR, PROCEDURE )
This function registers a session to supply the given procedure, independently of actual WAMP messaging. This is useful, e.g., if you want to “auto-register” a procedure to a given session.
The return is the same number that is sent in a REGISTERED message’s Registration
. No REGISTERED message is sent, however.
OBJ->unregister( SESSION_OBJ, REGISTRATION_ID )
Undoes a registration, without sending an UNREGISTERED message.