Compare Pastes

Differences between the pastes #144487 (11.09.2020 11:11) and #144488 (11.09.2020 11:12).
1
after_build_tx => sub {
2
  my ($tx, $app) = @_;
3
4
  $tx->once('chunk'=>sub {
5
    my ($tx, $chunk) = @_;
6
    my $url = $tx->req->url->to_abs;
7
    my $feed = $url->path->to_route;
8
9
    return 
10
      unless $url->path->to_route =~ /ffmpeg/
11
        and $tx->req->method eq 'POST';
12
    $feed = $app->feeds->{$feed} = {tx=>$tx, clients=>{}};
13
14
    $tx->req->max_message_size(0);
15
16
    $tx->req->content->asset->on(upgrade => sub {
17
      my ($mem, $file) = @_;
18
      $file->handle->close;
19
      $file->handle(IO::File->new("> /dev/null"));
20
    });
21
    
22
    $tx->on('chunk'=>sub {
23
      my ($tx, $chunk) = @_;
24
      $_->tx->send({binary => $chunk})
25
        for (values %{$feed->{clients}});
26
    });
27
  });
1
after_build_tx => sub {
2
  my ($tx, $app) = @_;
3
4
  $tx->once('chunk'=>sub {
5
    my ($tx, $chunk) = @_;
6
    my $url = $tx->req->url->to_abs;
7
    my $feed = $url->path->to_route;
8
9
    return 
10
      unless $url->path->to_route =~ /ffmpeg/
11
        and $tx->req->method eq 'POST';
12
    $feed = $app->feeds->{$feed} = {tx=>$tx, clients=>{}};
13
14
    $tx->req->max_message_size(0);
15
16
    $tx->req->content->asset->on(upgrade => sub {
17
      my ($mem, $file) = @_;
18
      $file->handle->close;
19
      $file->handle(IO::File->new("> /dev/null"));
20
    });
21
    
22
    $tx->on('chunk'=>sub {
23
      my ($tx, $chunk) = @_;
24
      $_->tx->send({binary => $chunk})
25
        for (values %{$feed->{clients}});
26
    });
27
  });