The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::WAMP::Role::Subscriber - Subscriber role for Net::WAMP

SYNOPSIS

package MyWAMP;

use parent qw( Net::WAMP::Role::Subscriber );

sub on_EVENT {
    my ($self, $msg, $SUBSCRIBE_msg) = @_;
    ...
}

sub on_SUBSCRIBED {
    my ($self, $msg, $SUBSCRIBE_msg) = @_;
    ...
}

sub on_ERROR_SUBSCRIBED {
    my ($self, $ERROR_msg, $SUBSCRIBE_msg) = @_;
    ...
}

sub on_UNSUBSCRIBED {
    my ($self, $msg, $UNSUBSCRIBE_msg, $SUBSCRIBE_msg) = @_;
    ...
}

sub on_ERROR_UNSUBSCRIBED {
    my ($self, $ERROR_msg, $UNSUBSCRIBE_msg, $SUBSCRIBE_msg) = @_;
    ...
}

package main;

my $wamp = MyWAMP->new( on_send => sub { ... } );

$wamp->send_SUBSCRIBE( {}, 'some.topic' );

$wamp->send_UNSUBSCRIBE( $subscr_id );

#A more convenient alternative to send_UNSUBSCRIBE
#so you don’t have to track the subscription ID yourself:
$wamp->send_UNSUBSCRIBE_for_topic( 'some.topic' );

$wamp->get_SUBSCRIBE( $msg );   #e.g., an EVENT message object
$wamp->get_SUBSCRIBE( $subscr_id );

DESCRIPTION

See the main Net::WAMP documentation for more background on how to use this class in your code.