Add publish() to Connection, mapped to PUB command

Signed-off-by: Pedro Melo <melo@simplicidade.org>
This commit is contained in:
Pedro Melo
2014-07-20 22:13:40 +01:00
parent 3c1a9a3083
commit d19a76677a

View File

@@ -129,6 +129,20 @@ sub subscribe {
return;
}
sub publish {
my ($self, $topic, $data, $cb) = @_;
return unless my $hdl = $self->{handle};
$cb = sub { }
unless $cb;
$hdl->push_write("PUB $topic\012" . pack('N', length($data)) . $data);
$self->_on_next_success_frame($cb);
return;
}
sub ready {
my ($self, $n) = @_;
return unless my $hdl = $self->{handle};