RSION = '0.006';
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::IOLoop;
use Mojo::JSON qw( decode_json encode_json );
use Mojo::Util qw( b64_decode b64_encode deprecated );
use IO::Socket::UNIX;
my
->helper(
'pubsub.publish' => sub {
my $self = shift;
my $msg = b64_encode(encode_json([@_]), "");
_send($msg . "\n");
return $self;
}
);
$app->helper(
'pubs
g) {
if ($msg =~ s/^(.+)\n//) {
my $b64 = $1;
my $args = decode_json(b64_decode($b64));
foreach my $subscriber (@{ $conf->{subs} }) {
$subsc