The “core” server Riskle_Server should be kept as simple as possible. Thus the below-mentionned protocol would not be part of it. Instead, it’ll just instantiate workers as defined at startup (see use cases).
The protocol would be implemented into a sub package called Riskle_Server_Dynamic (name tbd), allowing the client to ask for a specific worker to be used for the job.
There could be another built-in server engine, Riskle_Server_Http, able to parse http requests and forward them through a Zend_Controller_Request_Http.
The “core” server should provide an API to manage forked worker. Following operations should be available:
It will be up to the adapters to decide how the operations will be made available to clients.
// dynamic server adapter asks client which worker they want to be used
$server = Riskle_Tcp_Server::factory('Dynamic', array(
'address' => '127.0.0.1',
'port' => 9000,
));
$server->listen();
$server = Riskle_Tcp_Server::factory('Http', array(
'address' => '0.0.0.0',
'port' => 8080,
'documentRoot' =>'/var/www',
));
$server->listen();