PAGI
view release on metacpan or search on metacpan
docs/introduction.mkdn view on Meta::CPAN
## How does PAGI work?
PAGI is structured as a single, asynchronous coderef. It takes a `scope`,
which is a hashref containing details about the specific connection,
`send`, an asynchronous coderef that lets the application send event messages
to the client, and `receive`, an asynchronous coderef which lets the application
receive event messages from the client. Both coderefs return `Future` objects to
make back-pressure explicit.
This not only allows multiple incoming events and outgoing events for each
application, but also allows for a background process or coroutine so the application
can do other things (such as listening for events on an external trigger, like a
Redis queue).
In its simplest form, an application can be written as an **asynchronous
function in modern Perl**, like this:
```perl
use Future::AsyncAwait;
async sub application ($scope, $receive, $send) {
( run in 1.345 second using v1.01-cache-2.11-cpan-df04353d9ac )