Created
July 19, 2025 19:24
-
-
Save jonathanstowe/bda9bbe376b928cc3f52898e6f531aa7 to your computer and use it in GitHub Desktop.
Async HTTP "polling"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env raku | |
use v6; | |
use Manifesto; | |
use Cro::HTTP::Client; | |
my $manifesto = Manifesto.new; | |
$manifesto.add-promise: Cro::HTTP::Client.get('http://localhost:3333/'); | |
my $supply = supply { | |
whenever $manifesto -> $thing { | |
emit $thing; | |
} | |
whenever $manifesto.empty { | |
$manifesto.add-promise: Cro::HTTP::Client.get('http://localhost:3333/'); | |
} | |
} | |
react { | |
whenever $supply -> $response { | |
say await $response.body; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment