sub ws_feed { my $ws = shift; #~ $ws->inactivity_timeout(300);# переподключение вебсокета my $feed = $ws->param('feed') or return $ws->send("none param feed?"); $ws->log->error("Client connect try feed=$feed, but feeds=[@{[ keys %{ $ws->app->feeds} ]}]"); $feed = $ws->app->feeds->{$feed} or return $ws->send("yet none feed ".$ws->param('feed')); my $id = "$ws"; $ws->log->error("Client connected: $id; to feed tx=".$feed->{tx},); $feed->{clients}{$id} = $ws; $ws->tx->with_protocols('binary'); $ws->on( finish => sub { my( $ws, $code, $reason ) = @_ ; my $id = "$ws"; $ws->log->error("Client disconnected: $id"); delete $feed->{clients}{ $id }; } ); }