package Datastar::SSE;
use strict;
use warnings;
use 5.10.0;
our $VERSION = '0.26';
use JSON ();
use HTTP::ServerEvent;
use Scalar::Util qw/reftype/;
use Exporter qw/import unimport/;
# use Datasta
ES)] );
my $json; # cache
sub _encode_json($) {
($json ||= JSON->new->allow_blessed->convert_blessed)->encode( @_ );
}
sub _decode_json($) {
# uncoverable subroutine
($json ||= JSON->new->allow
ata, +{ onlyIfMissing => _bool( $only_if_missing )};
}
if (ref $signals) {
$signals = _encode_json( $signals);
}
push @data, +{ signals => $signals };
$class->_datastar_event(
$event,
$opti