trict, -signatures, -async_await;
use Mojo::Promise;
use Mojo::IOLoop;
use Mojo::JSON qw/ true false from_json to_json /;
use Syntax::Keyword::Try;
use Text::Trim 'trim';
use Data::GUID::URLSafe;
use
ne_line eqq belongs_to trim true false
unique_id hashify next_tick_p sleep_p
encode_json decode_json
/;
our %EXPORT_TAGS = (bool => [qw/ true false /]);
our $VERSION = "v0.0.36";
sub make_on
ub {
$p->resolve();
});
return $p;
}
sub encode_json :prototype(_) ($data) { encode_utf8 to_json $data }
sub decode_json :prototype(_) ($bytes) { from_json decode_utf8 $bytes }
1;
til qw/
trim :bool unique_id hashify next_tick_p sleep_p
encode_json decode_json
/;
use BoardStreams::Exceptions qw/ jsonrpc_error /;
use BoardStreams::REs;
use BoardStreams::DBMigrations;
us
) if @new_dead_worker_ids_for_stream;
$tx->commit;
}
});
# send JSON, but only if transaction is not destroyed
async sub _send_p ($c, $data) {
my sub get_
return min($tx->max_websocket_size, $MAX_WEBSOCKET_SIZE);
}
my $message = encode_json $data;
my $whole_length = length $message;
if ($whole_length <= get_max_size) {
package BoardStreams::Error::JSONRPC;
use Moo;
extends 'BoardStreams::Error';
use BoardStreams::Util 'make_one_line';
use Data::Dump 'dump';
use Carp 'croak';
use experimental 'signatures';
use o
;
return make_one_line $text;
};
our $VERSION = "v0.0.36";
has '+code' => (
default => 'jsonrpc_error',
);
has code_num => (
is => 'ro',
isa => sub ($code) {
croa
a string" unless !length(ref $message) and defined $message;
},
required => 1
);
sub TO_JSON ($self) {
return {
code => int $self->code_num,
message => $self->message,
ebsockets_observable';
use BoardStreams::Client::Util 'unique_id';
use BoardStreams::Util 'decode_json', 'eqq';
use RxPerl::Mojo ':all';
use Mojo::UserAgent;
no autovivification;
has url => sub { d
= @$data_ws;
$ws or die 'Attempted to send data while not connected';
$ws->send({ json => $data });
});
# read incoming messages
$self->{incoming_o} = rx_subject->new;
al and $i == ($ongoing_messages->{$identifier}{i} // -1)) {
my $data = decode_json $ongoing_messages->{$identifier}{bytes};
delete $ongoing_messages->{$identifi