Skip to content

Instantly share code, notes, and snippets.

@jonathanstowe
Created July 19, 2025 19:24
Show Gist options
  • Save jonathanstowe/bda9bbe376b928cc3f52898e6f531aa7 to your computer and use it in GitHub Desktop.
Save jonathanstowe/bda9bbe376b928cc3f52898e6f531aa7 to your computer and use it in GitHub Desktop.
Async HTTP "polling"
#!/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