Questions about Cro, a set of Perl 6 tools and libraries for building distributed systems.
Questions tagged [cro]
38 questions
13
votes
1 answer
Running a Raku Cro app as a persistent service
I'd like to run a perl6/raku Cro app as a service behind a frontend webserver.
Just running cro run won't handle restarting after segfaults & reboots.
Previously with perl5 I've used FastCGI - however Cro::HTTP::Server's…

fireartist
- 165
- 4
12
votes
1 answer
Understanding Cro request/response cycle and memory use
I'm a bit confused about how Cro handles client requests and, specifically, why some requests seem to cause Cro's memory usage to balloon.
A minimal example of this shows up in the literal "Hello world!" Cro server.
use Cro::HTTP::Router;
use…

codesections
- 8,900
- 16
- 50
12
votes
1 answer
Understanding the point of supply blocks (on-demand supplies)
I'm having trouble getting my head around the purpose of supply {…} blocks/the on-demand supplies that they create.
Live supplies (that is, the types that come from a Supplier and get new values whenever that Supplier emits a value) make sense to me…

codesections
- 8,900
- 16
- 50
12
votes
3 answers
Raku Cro service subscribing to data "in the background" general guidance
I am attempting to put together a Cro service that has a react/whenever block consuming data "in the background" So unlike many examples of websocket usage with Cro, this has nothing to do with routes that may be accessed via the browser.
My use…

camstuart
- 623
- 3
- 13
12
votes
1 answer
Perl 6 Cro's stub doesn't run: HTTP/2 is requested, but ALPN is not supported
I created a stub service with Perl 6's cro but it errors out because "ALPN is not supported".
$ cro stub http ds4 ds4
Stubbing a HTTP Service 'ds4' in 'ds4'...
First, please provide a little more information.
Secure (HTTPS) (yes/no) [no]:…
user2410502
11
votes
1 answer
Adding Authorization or Headers with Cro::WebSocket::Client?
I'm using Cro HTTP Authentication/Authorization/Sessions very successfully with HTTP routes.
Then I added a route that creates a web-socket using Cro::HTTP::Router::WebSocket, and I can connect to it with Cro::WebSocket::Client and everything works…

Curt Tilmes
- 3,035
- 1
- 12
- 24
10
votes
2 answers
Secure websockets with Cro
Briefly: I created a service on an internet server using Cro and websocket. Very simple using Cro examples. No problem when sending and receiving data from an HTML page when the page is served as localhost. When the page is served using https, the…

Richard Hainsworth
- 1,585
- 7
- 9
10
votes
1 answer
How to implement a global exception handling in Raku Cro Application
I am working with a rather larger Cro application with dozens of routes, models and other logic. At the moment in each route block is a CATCH to handle exception. That is not much maintenance friendly, not to speak of the work to add them.
So, I was…

user13195651
- 165
- 1
- 4
9
votes
1 answer
Is there a way to consume request.body multiple times in Cro?
I'm writing a middleware that consumes request.body and does some validation like so:
before-matched {
request-body -> (:$email, :$captcha-token, :$captcha-solution, *%_) {
# Validate the email.
unless Email::Valid.mx($email).so…

Andinus
- 93
- 4
9
votes
1 answer
Why does Raku crash with 'Abort trap: 6' while using Cro on a MacOS Catalina?
I'm using macOS Catalina and trying to execute a simple command raku -e "use Cro::HTTP::Route". I will get a message [1] 19228 abort raku in the Zsh shell or Abort trap: 6 in the Bash shell. I face the same issue when using an OpenSSL module like…

Mikhail Khorkov
- 593
- 2
- 12
9
votes
1 answer
Trouble using the cro command-line tool as documented
I'm running Rakudo Star 2019.03.1 on Windows 7, Cro was installed by zef. Following the Getting Started section on the Cro website, the following should work:
The cro stub command generates stub services for you, to get started
more quickly and…

zb226
- 9,586
- 6
- 49
- 79
9
votes
2 answers
Basic Authentication in perl6 with Cro
I am looking for a simple solution to protect my routes with the Basic Authentication mechanism with Cro. In my example I'd like to see a 401 Unauthorized if you don't provide any credentials at all. If you provide wrong credentials I like to see a…

Martin Barth
- 796
- 4
- 13
9
votes
1 answer
Cro WebSocket client doesn't see when the server goes out
The client program below receives messages from a WebSocket server.
It doesn't send any messages.
CLIENT
use v6;
use Cro::WebSocket::Client;
constant WS-URL = 'ws://localhost:20000/status';
constant TIMEOUT-TO-CONNECT = 5; # seconds
my…

zentrunix
- 2,098
- 12
- 20
8
votes
1 answer
Difficulties installing Cro: "Failed to find dependencies: CBOR::Simple"
I'm hoping to try out the Cro library in Raku: https://cro.services/docs
However, when I try to install it using zef, I get this output:
zef install Cro::HTTP …

jsaigle
- 444
- 2
- 7
8
votes
1 answer
How to get the Host or :authority header in Cro when using HTTP/2
When using Cro with HTTP1.1 I can access the requested Host via both the host method request.uri.host in Cro::Uri as well as the Host or :authority header sent by the browser via the request.header method in Cro::HTTP::Request.
However, when I use…

acw
- 447
- 2
- 9