Paste #144491 |
pasted on 11.09.2020 11:40
- Edit to this paste
- Raw
- Compare it with the parent paste
- Look at the parent paste
- Show paste tree
-
Compare with paste
#
Text paste
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | sub ws_feed { my $ws = shift; #~ $ws->inactivity_timeout(300);# переподключение вебсокета my $feed = $ws->param('feed') or return $ws->send("none param feed?"); $ws->log->info("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->info("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 }; } ); } |