Сравнение постов

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