in reply to Net::Async::WebSocket::Server in a separate main loop
if (//data to read) { $loop->loop_once; }
That feels weird - I think you should always call ->loop_once from within your other main loop.
Alternatively, you could set up a timer callback to be called from within IO::Async:
use IO::Async::Timer::Periodic; use IO::Async::Loop; my $loop = IO::Async::Loop->new; my $timer = IO::Async::Timer::Periodic->new( interval => 1, on_tick => sub { // something before // something after }, ); $timer->start; $loop->add( $timer ); $loop->run;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Net::Async::WebSocket::Server in a separate main loop
by Talkabout (Novice) on Jan 12, 2023 at 18:22 UTC | |
by NERDVANA (Priest) on Jan 12, 2023 at 22:52 UTC | |
|
Re^2: Net::Async::WebSocket::Server in a separate main loop
by Talkabout (Novice) on Jan 12, 2023 at 19:00 UTC | |
by alexander_lunev (Pilgrim) on Jan 13, 2023 at 06:19 UTC | |
by NERDVANA (Priest) on Jan 13, 2023 at 17:50 UTC | |
by alexander_lunev (Pilgrim) on Jan 13, 2023 at 19:15 UTC |