LasTres/lib/LasTres/Controller/Websocket/OutputPacket.pm

23 lines
341 B
Perl

package LasTres::Controller::Websocket::OutputPacket;
use v5.36.0;
use strict;
use warnings;
use Moo::Role;
use JSON qw/encode_json/;
requires qw/new identifier data/;
sub send ( $self, $ws ) {
return $ws->send({json =>
{
command => $self->identifier,
data => $self->data
}
});
}
1;