h" => ($code, $reason));
}
);
$s->tx->on(
json => sub {
my ( $tx, $msg ) = @_;
$s->{syn}->parse($msg);
}
)->catch( sub { $ret = 0 } )->wait;
return $ret;
}
sub _send {
shift->tx->send( { json => shift } );
}
sub _send_keepalive {
# send keepalive every inactivity_timeout/2
state
$syn->on( 'all' => sub { $s->psws_reply( $c, @_ ) } );
$c->on(
json => sub {
$app->log->debug(
sprintf( "RCV from %s: %s"
'SNT to %s: %s', $client, np $res) );
$c->psws_clients->{$client}->{tx}->send( { json => $res } );
}
# now reply to sender
$res = $syn->notified($
}
$c->app->log->debug( sprintf( 'SNT to %s: %s', $id, np $res) );
$c->tx->send( { json => $res } );
}
}
1;
__END__
=pod
=head1 NAME
Mojolicious::Plugin::PubSub::WebSocket - Pl