Rand Stats

FastCGI::NativeCall::Async

zef:jonathanstowe

FastCGI::NativeCall::Async

An asynchronous wrapper for FastCGI::NativeCall

Build Status

Synopsis

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 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

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

This is free software see the LICENCE file in the distribution.

© 2017 - 2021 Jonathan Stowe