### ----------------------------------------------------
### -- FastCGI::NativeCall::Async
### -- Licenses: Artistic-2.0
### -- Authors: Jonathan Stowe <jns+gh@gellyfish.co.uk
### -- File: README.md
### ----------------------------------------------------
# FastCGI::NativeCall::Async

An asynchronous wrapper for [FastCGI::NativeCall](https://github.com/jonathanstowe/raku-fcgi-nativecall)

![Build Status](https://github.com/jonathanstowe/FastCGI-NativeCall-Async/workflows/CI/badge.svg)

## Synopsis

```raku
use FastCGI::NativeCall::Async;

my $fna = FastCGI::NativeCall::Async.new(path => "/tmp/fastcgi.sock", backlog => 32 );

my $count = 0;

react {
    whenever $fna -> $fcgi {
	    say $fcgi.env;
        $fcgi.Print("Content-Type: text/html\r\n\r\n{++$count}");
    }
}
```

## Description

The rationale behind this module is to help
[FastCGI::NativeCall](https://github.com/jonathanstowe/raku-fcgi-nativecall)
play nicely in a larger program by managing the blocking accept loop as
a Supply that can for instance be used in a ```react``` block as above.
It doesn't actually allow more than one FastCGI request to be processed at
once for the same URI as the protocol itself precludes that.  However it
does allow more than one FastCGI handler to be present in the same Raku
program, potentially sharing data and other resources.

## Installation

You will need a working HTTP server that can handle FastCGI to be able to
use this properly.

Assuming you have a working Rakudo installation you should be able to install this with *zef* :

     zef install FastCGI::NativeCall::Async

     # Or from a local clone 

     zef install .

## Support

This module itself is fairly simple, but does depend on both other modules and the configuration of
of your HTTP Server.

Please send any suggestions/patches etc to [github](https://github.com/jonathanstowe/FastCGI-NativeCall-Async/issues)

I'd be interested in working configurations for various HTTP servers.

## Licence & Copyright

This is free software see the [LICENCE](LICENCE) file in the distribution.

© 2017 - 2021 Jonathan Stowe


