Сравнение постов
Различия между постами
#144490 (11.09.2020 11:14)
и
#144491 (11.09.2020 11:40).
1 | 1 | sub ws_feed { |
2 | 2 | my $ws = shift; |
3 | 3 | #~ $ws->inactivity_timeout(300);# переподключение вебсокета |
4 | 4 | my $feed = $ws->param('feed') |
5 | 5 | or return $ws->send("none param feed?"); |
6 | 6 | |
7 | $ws->log->error("Client connect try feed=$feed, but feeds=[@{[ keys %{ $ws->app->feeds} ]}]"); | |
7 | $ws->log->info("Client connect try feed=$feed, but feeds=[@{[ keys %{ $ws->app->feeds} ]}]"); | |
8 | 8 | |
9 | 9 | $feed = $ws->app->feeds->{$feed} |
10 | 10 | or return $ws->send("yet none feed ".$ws->param('feed')); |
11 | 11 | |
12 | 12 | my $id = "$ws"; |
13 | $ws->log->error("Client connected: $id; to feed tx=".$feed->{tx},); | |
13 | $ws->log->info("Client connected: $id; to feed tx=".$feed->{tx},); | |
14 | 14 | $feed->{clients}{$id} = $ws; |
15 | 15 | $ws->tx->with_protocols('binary'); |
16 | 16 | |
17 | 17 | $ws->on( |
18 | 18 | finish => sub { |
19 | 19 | my( $ws, $code, $reason ) = @_ ; |
20 | 20 | my $id = "$ws"; |
21 | 21 | $ws->log->error("Client disconnected: $id"); |
22 | 22 | delete $feed->{clients}{ $id }; |
23 | 23 | } |
24 | 24 | ); |