json

$ws->on(json => sub {
my ($ws, $json) = @_;
...
});

Emitted when a complete WebSocket message has been received, all text and binary messages will be automatically JSON decoded. Note that this event only gets emitted when it has at least one subscriber.