npm.io
1.1.1 • Published 5 years ago

fibjs-fastcgi-client

Licence
ISC
Version
1.1.1
Deps
0
Size
39 kB
Vulns
0
Weekly
0

fibjs-fastcgi-client

A FastCGI client implementation in fibjs, mainly designed for cummunication with PHP.
let www_root="/mnt/e/workplace/fib_fcgi/php";
let idx=0;
let fcgi = require("fibjs-fastcgi-client");
var client = new fcgi.FcgiClient({host:"127.0.0.1",port:9000,root:www_root});
var rsp=client.requestByParams("/hi.php","a=abc&i="+(idx++));
console.log(rsp);
client.close();

#use pool let fcgi = require("fibjs-fastcgi-client");
var client = new fcgi.FcgiClientPool({host:"127.0.0.1",port:9000,min:1,max:4,root:www_root});
for(var i=0;i<100;i++){
require("coroutine).start(function(){
var rsp=client.requestByParams("/hi.php","a=abc&i="+(idx++));
console.log(rsp); });
}

#use unixSocket var client = new fcgi.FcgiClient({url:"unix:/var/php.socket",root:www_root});
var client = new fcgi.FcgiClient({url:"pipe://./pipe/php.socket",root:www_root});
var client = new fcgi.FcgiClient({url:"tcp://./pipe/php.socket",root:www_root});