|
|
@ -113,6 +113,7 @@ sub livecam { |
|
|
|
$self->app->ua->get($url->to_abs); # setup cookies |
|
|
|
$self->app->ua->get($url->to_abs); # setup cookies |
|
|
|
$url->path('/camws/cam-image.php'); |
|
|
|
$url->path('/camws/cam-image.php'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# handler |
|
|
|
my $send_image = sub { |
|
|
|
my $send_image = sub { |
|
|
|
my $seed = sprintf "%.15f", rand(1); |
|
|
|
my $seed = sprintf "%.15f", rand(1); |
|
|
|
$url->query(cam => $cam->{id}, r => $seed); |
|
|
|
$url->query(cam => $cam->{id}, r => $seed); |
|
|
@ -135,6 +136,7 @@ sub livecam { |
|
|
|
$send_image->(); # initial send |
|
|
|
$send_image->(); # initial send |
|
|
|
|
|
|
|
|
|
|
|
Mojo::IOLoop->stream($self->tx->connection)->timeout(30); |
|
|
|
Mojo::IOLoop->stream($self->tx->connection)->timeout(30); |
|
|
|
|
|
|
|
# log events inside timer's handler to main app log |
|
|
|
Mojo::IOLoop->singleton->reactor->on(error => sub { |
|
|
|
Mojo::IOLoop->singleton->reactor->on(error => sub { |
|
|
|
my ($reactor, $err) = @_; |
|
|
|
my ($reactor, $err) = @_; |
|
|
|
$self->app->log->error($err); |
|
|
|
$self->app->log->error($err); |
|
|
|