Yar是一个支持多种打包协议的,并行的RPC框架.
它基于HTTP协议,在libcurl基础上开发而成
简单的Server:
classAPI{ /***thedocinfowillbegeneratedautomaticallyintoserviceinfopage.*@params*@return*/ publicfunctionapi($parameter,$option="foo"){ } protectedfunctionclient_can_not_see(){ }} $service=newYar_Server(newAPI());$service->handle();?>简单调用:
$client=newYar_Client("https://host/api/");$result=$client->api("parameter);?>并行调用:functioncallback($retval,$callinfo){ var_dump($retval);} Yar_Concurrent_Client::call("https://host/api/","api",array("parameters"),"callback");Yar_Concurrent_Client::call("https://host/api/","api",array("parameters"),"callback");Yar_Concurrent_Client::call("https://host/api/","api",array("parameters"),"callback");Yar_Concurrent_Client::call("https://host/api/","api",array("parameters"),"callback");Yar_Concurrent_Client::loop();//send?>更多信息参看: YaratGithub
评论